The documentation is pretty clear on this. Under FileRead, it says
"if successful, returns a handle to an open file stream; otherwise,
returns 0".
So your code should be:
fileHandle = FileOpen (...);
if (fileHandle)
{
// file exsit !
}
-- Keith
At 6:23 PM -0800 2/19/02, Cheok Yan Cheng wrote:
>I am using sdk 3.5.
>
>Before I open a file, I try to check whether the file
>exsit in my system
>---
> fileHandle = FileOpen(0, "game0", CreatorId,
>CreatorId, fileModeReadOnly, NULL);
>
> if(FileError(fileHandle) == 0)
> {
> // file exsit !
> }
>---
>
>I try to open a file that has NOT been created on my
>system.
>However, when my emulator execute error checking
>statement
>
>FileError(fileHandle)
>
>it will complain that fileHandle is pointing to a
>unallocated chunk of memory.
>
>What is the correct way to check whether the file had
>been created before
>reading it ?
>
>Thank you.
>
>regards
>yccheok
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/