Help with the File System
I'm trying to implement a standard "Save" function in my code and am having trouble. I had this down in OS 9, but now it seems there is more involved a nd I can't figure out what I'm missing.
Here's my code (I already successfully implemented a Nav dialog and got a fi lename in my NavReplyRecord, but all the subsequent calls require a FSRef an d I can't figure out where I'm supposed to get that.
forkNameLength = sizeof reply.saveFileName;
status = FSCreateFileUnicode( &ref, forkNameLength, (UniChar*)reply.saveFile Name, 0, NULL, newRef, NULL );
// Open fork
status = FSOpenFork( &ref, forkNameLength, (UniChar*)reply.saveFileName, per missions, &forkRefNum );
// Set write position status = FSSetForkPosition( forkRefNum, positionMode, positionOffset );
requestCount = sizeof VELOCITY; // some test data status = FSWriteFork( forkRefNum, positionMode, positionOffset, requestCount , &buffer, &actualCount );
status = FSCloseFork( forkRefNum );
THIS ISN'T WORKING - I think it's the ref field which I haven't yet acquired.
Help would be appreciated (I've tried looking at example code but I have a r eal hard time following other people's code - and I don't learn as much).
Thanks, John |