--- Keith Rollin wrote:
> 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
> 

I am shocked and amazed to find that I am now in the position to add
something to what Keith said.  To wit:

(From the Reference)
"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."

Therefore, shouldn't one use

  Err err;
  fileHandle = FileOpen (..., &err);
  if (fileHandle && (err == errNone) )
  {
    // file exists !
  }

However, I don't think this tests whether or not a file exists.  If it
doesn't already exist, the above code creates it.


__________________________________________________
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