At 09:54 PM 10/21/2004, you wrote:
So I guess the File Streaming tools are the ones I should use? I've written a small code fragment to attempt to create a text file on the Palm:

Err *errp;
FileHand myStream = FileOpen(0,"a.txt",0,0,fileModeReadWrite,errp);
if (errp) { Message("file error"); }  // Message() is elsewhere
FileClose(myStream);

This compiles fine, but when I try to run it on the POSE, I get a message box that says "App just wrote to memory location 0x000D5912, which is in the storage heap. In order to protect the integrity of the user's data, such direct access is not allowed. Instead, applications should use speacial Palm OS functions for this purpose."

Your FileOpen call is incorrect. Try:

Err err;
FileHand myStream = FileOpen(0,"a.txt",0,0,fileModeReadWrite,&err);
if (err) { Message("file error"); }  // Message() is elsewhere
FileClose(myStream);

Your old code used an uninitialized pointer, when it should have passed the address of an Err variable.

-- Ben Combee, Technical Lead, Developer Services, PalmSource, Inc.
   "Combee on Palm OS" weblog: http://palmos.combee.net/
   Developer Fourm Archives:   http://news.palmos.com/read/all_forums/



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

Reply via email to