On Wed, Feb 20, 2002 at 08:12:03AM -0800, Max Bian wrote:
> FileRead(fd, buf, 1, 1000, NULL); and
> FileRead(fd, buf, 1000, 1, NULL);
>
> I don't see any reason why the two cases will be treated differently by
> FileRead internally. Anyone?
The difference is in FileRead()'s behaviour when the request can't be
satisfied.
Suppose there are only 500 bytes left in the stream.
Your first FileRead asks to read one thousand objects of size 1 byte.
FileRead should return 500, indicating that 500 objects were available
and have been read.
Your second FileRead asks to read one object of size 1000 bytes.
This time it should return 0, indicating that no complete objects were
available.
This constitues a bit of a corner case, and Palm OS APIs are
traditionally not very strong in corner cases. ISTR that FileRead is
fairly aggressive in setting error indications in situations like this.
I would have to do some testing to feel comfortable writing "does"
instead of "should" above. :-)
John
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/