"ThuNguyet Nguyen" <[EMAIL PROTECTED]> wrote in message
news:40397@palm-dev-forum...
> >This function reads from a file into a buffer provided by the caller.
> Is "the caller" ExgDBRead()?
Yes.
> So don't I have to allocate memory for this buffer?
Correct.
> How do I know that I am out of data in the callback function with
FileRead()?
> FileRead() hits EOF and return error first or return *sizeP = 0 first?
You're using a global counter to keep track of how many bytes remain in the
file. You don't really need to do this since FileRead will tell you when you
hit the end of file (see the docs for details), but it should work. (Or
maybe not - do you have access to globals when this code is running?) As
it's coded now, you know when you've reached the end of file by whether
totalBytesLeft is zero.
> "filesize" that I get back from FileTell() is always greater than "size".
Why are they different?
I don't know about FileTell, but you can always handle EOF when you call
FileRead instead.
> Is the data I get from file stream invalid, so I can not create a database
from it?
> What can I try to fix this bug?
You can always try writing the same data out to a host file using the
HostControl API. Then you can see if it's valid by dropping it onto Poser
and using your app to access it.
--
Danny Epstein
OS Engineer, Palm Inc.
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/