Adam's right. Anyone can look at the source code for FileOpen and see that it
fails to set the result to NULL if an error occurs after the initial FileHand is
allocated. So, the documentation is wrong.

-- Keith Rollin
-- Palm OS Emulator engineer






Adam Wozniak <[EMAIL PROTECTED]> on 07/17/2000 10:56:50 AM

Please respond to "Palm Developer Forum" <[EMAIL PROTECTED]>

Sent by:  Adam Wozniak <[EMAIL PROTECTED]>


To:   "Palm Developer Forum" <[EMAIL PROTECTED]>
cc:    (Keith Rollin/US/PALM)
Subject:  Re: FileOpen: never returns NULL



Avi Halachmi wrote:

> hi
> i'm trying to use file streams as follows.
>
> hFile = FileOpen(0,<pointer_to_string>,0,0,fileModeReadOnly,&err);
>
> when openning an exising file, hFile is usable, and err is 0,
> HOWEVER
> when the file doesn't exist, error is non zero, but SO IS hFile
>
> in the SDK reference, it says FileOpen should return zero when not
> successfull.
>
> any suggestions??
>
> regards
> avi.
>
> --
> For information on using the Palm Developer Forums, or to unsubscribe, please
see http://www.palmos.com/dev/tech/support/forums/

Check err before proceeding.  In my apps I wrapped FileOpen with my own function
which
returns NULL if there is an error.

--
Adam Wozniak                     Senior Software Design Engineer
                                 Surveyor Corporation
[EMAIL PROTECTED]                4548 Broad Street
[EMAIL PROTECTED]          San Luis Obispo, CA 93401



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





-- 
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