PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

File I/O options confusion

Perhaps it's an overload in info, or the fact that its 2am here, but Im a bit confused over my choices for PPC file I/O.

Up until now, Ive been using the "fopen" command for most of my files in my GapiDraw app, but in most places Ive seen people choose to use the "CreateFile" command. Now, I know that in the past WinCE wasnt able to use fopen at all, but that it isnt an issue now.
Is this correct?

The reason I ask is that when I tried to load a file using fopen, it worked fine in Win32, but in porting the code over to my PPC it didnt seem to work at all. Im just wondering if it could be a bug in my code, or if fopen just isnt a valid option for file-loading on a PPC. I know that PPC2002 is also a bit fussy on how it handles filenames...perhaps that could be it.

(I hope that all made sense...again, its the middle of the night here...hehe)
stdio (fopen, fwrite, etc) has been supported since Windows CE 2.12 (HPC Pro), so it's fine to use it.

Note that fopen takes standard ansi strings, while CreateFile requires Unicode. Make sure you aren't passing unicode chars to fopen, or use _wfopen / _tfopen.

If it still doesn't work then you are probably using fopen incorrectly. If you post the source code in question then I'm sure someone can point out the problem.

Dan East
As an aside, I've tested performance on Windows machines and have always found CreateFile (and the other Win32 API) faster than the standard C equivalents.