When I write to a FileStream in a Palm it looks like the File gets
truncated from the point I wrote. ie I can find the text I wrote, but
what was there originally is missing after words. Why is this happening?
Any Idea.....

My function to write the text on to a File Stream is as follows


static int WriteChars(CharPtr filename, CharPtr text, long seekPos)
{
 // Vars
 Err err = 0;
    FileHand theStream = NULL;
    int numObjects=0;

    theStream = FileOpen(0, filename, sysFileTFileStream,
HLPRespXMLLibCreatorID, fileModeUpdate, &err);
    err = FileSeek(theStream, seekPos, fileOriginBeginning);
    if(err)
    {
  ErrFatalDisplay("Could Not Seek to that point in the XML file!");
  return -1;
    }
    numObjects = FileWrite(theStream, text, (long) sizeof(char),
(long)(StrLen(text)-1), &err);
    if(err)
    {
  ErrFatalDisplay("Could not write to file");
  return -1;
    }
    FileFlush(theStream);
    FileClose(theStream);
    return numObjects;
}

Any help is highly appreciated.

Thank you,
Chida



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