On Mon, May 08, 2000 at 02:11:25AM -0700, Pankaj Kumar wrote:
> I think I'm missing something very basic in the File streaming API. The
> snippet of code below tries to find out the size of a file and then seeks
> back to the beginning of the file. FileOPen() succeeds and returns a handle.
> But the FileTell() call always returns zero. I've inserted GetLastError()
> calls after every file API call but the returned value is 0 (no error). I
> tried changing the FileSeek call to FileSeek(fp, -1L, fileOriginEnd) with no
> change in the result of the FileTell call.
> openMode is fileModeReadWrite.
> Any comments on where I could be wrong?
>
> Code:
> fp = FileOpen(cardNo, nameP, 0, 0, openMode, NULL);
FROM THE FileStream.h:
#define fileModeReadWrite (0x40000000UL) // create for read/write access, discarding
previous if any */
"DISCARDING PREVIOUS IF ANY" is the key.
Maybe you want Update or Append?
> FileSeek(fp, 0, fileOriginEnd);
This will be 0 if the file has no data in it, or has been cleared by opening it
ReadWrite.
> FileTell(fp, &size, NULL);
FileTell will return the total size in the parameter you have marked as Null without
all those seeks.
> FileSeek(fp, 0, fileOriginBeginning);
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/