--- Cheok Yan Cheng wrote:
> 
> 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 !
>     }
> ---

1. You didn't check to make sure fileHandle isn't 0 before you passed
it to FileError().

2. "In some cases, on some platforms, FileOpen returns a non-zero value
when it has failed to open a file; thus, it is always a good idea to
check the errP parameter value to determine if an error has occurred."
-- But you didn't pass in anything for the errP parameter so you can't
check it!

3. You passed in the creator id for 2 params.  Was that what you wanted
to do?  The prototype for FileOpen() is:

  FileHand FileOpen (UInt16 cardNo, const Char *nameP, UInt32 type, 
    UInt32 creator, UInt32 openMode, Err *errP)


__________________________________________________
Do You Yahoo!?
Yahoo! Sports - Coverage of the 2002 Olympic Games
http://sports.yahoo.com

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to