On a NX70V I seek to know the size of a file (*not empty*) placed on a MS. Research occurs well (the file is found) on the other hand the indication from turned over size is always 0 (?!). When I move at the end of the file and seeks to know the current position, I obtain a vfsErrFileEOF error. Why ?
static void Echo(FieldType *field, char *message) { char buffer[80]; StrCopy(buffer,message); StrCat(buffer,"\n"); FldInsert(field,buffer,StrLen(buffer)); } static void getFileSize(FieldType *field, Char *fileName) { Err err; Char msg[160]; FileRef fileRef=0; UInt32 vfsMgrVersion; UInt16 volRefNum; UInt32 volIterator; UInt32 fileSize; err = FtrGet(sysFileCVFSMgr, vfsFtrIDVersion, &vfsMgrVersion); if (err == errNone) { Echo(field,"VSF manager available"); volIterator = vfsIteratorStart; do { if (VFSVolumeEnumerate(&volRefNum, &volIterator)==errNone) { err=VFSFileOpen(volRefNum, fileName, vfsModeRead, &fileRef); if (err==errNone) { StrPrintF(msg,"File '%s' found",fileName); Echo(field,msg); // comment this line to try the other case #define MODE 1 #ifdef MODE err=VFSFileSize(fileRef, &fileSize); //--> fileSize allways set to 0 ?! #else err=VFSFileSeek (fileRef, vfsOriginEnd, 0); switch (err) { case expErrNotOpen : Echo(field,"NotOpen"); break; case vfsErrFileBadRef : Echo(field,"FielBadRef"); break; case vfsErrFileEOF : Echo(field,"FileEOF"); // --> allways FileEOF break; case vfsErrIsADirectory : Echo(field,"IsADirectory"); break; case sysErrParamErr : Echo(field,"ParamErr"); } if (err == errNone) { err=VFSFileTell(fileRef, &fileSize); } #endif if (err == errNone) { StrPrintF(msg,"File size : %d",fileSize); Echo(field,msg); } VFSFileClose(fileRef); } } else err=0; } while (err); } } -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/