On 1/8/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I am trying to read a text file from the SD card. Any pointers / code samples > would be very handy. I have been trying to read through the documentation > and I am really confused as to what I need to do... (VFS, Expansion Manager > Volumes arghhh... it should be as easu as FileOpen!!)
http://www.palmos.com/dev/dl/dl_codesamples/ http://www.palmos.com/dev/dl/dl_codesamples/sample_features.html http://www.palmos.com/dev/dl/dl_codesamples/expansion_samples.html and... some code http://kb.palmsource.com/cgi-bin/palmsource.cfg/php/enduser/std_adp.php?p_faqid=174 you have to use the expansion manager to obtain a volume. when you have a volume; you can then open a file quite easily. its not FileOpen, but, VFSFileOpen (below, is a stripped chunk of a functino) static Err HandleCardFile(UInt16 volRefNum, Char *fileName) { FileRef ref=0; Err err=0; err = VFSFileOpen(volRefNum, fileName, vfsModeRead, &ref); if (err) return err; ... VFSFileSeek(ref, vfsOriginBeginning, resOffset); ... VFSFileRead(ref, resLen, mybuffer, &numBytesRead); if (ref) VFSFileClose(ref); return err; } to get a handle on the volume: UInt16 volRefNum; UInt32 volIterator; volIterator = vfsIteratorStart; while (volIterator != vfsIteratorStop) { err = VFSVolumeEnumerate(&volRefNum, &volIterator); if (err == errNone) .... // volRefNum = valid!! else volIterator = vfsIteratorStop; // handle error by breaking out of the loop } now; there may be multiple volumes on a device; so, you need to do a little extra checking to make sure you have the right one. -- // Aaron Ardiri -- For information on using the PalmSource Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
