hi,

to print out the correct value you need to cast the size to long.
try this.

    VFSFileSize(file, &numBtW);
    StrPrintF(msg,"Size : %ld",numBtW);
                          ^^^^
%d -> %ld

regards,

danny

www.toysoft.ca


> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Behalf Of JiheM
> Sent: Thursday, March 20, 2003 9:32 AM
> To: Palm Developer Forum
> Subject: [CW9.1][NX70V] VFSFileSize or CW bug ?
> 
> 
> static void testVFS(FieldType *field)
> {
>  UInt16 refNum;
>  UInt32 numBtW;
>  FileRef file;
>  char msg[160];
> 
>  if (MStickRefNum(&refNum)==errNone) {
>   Echo(field,"Stick ready");
>   if (VFSFileOpen(refNum, "TEST.TXT", vfsModeReadWrite | vfsModeCreate,
> &file)==errNone) {
>    VFSFileWrite (file, 10, "ABCDEFGHIJ", &numBtW);
>    VFSFileClose(file);
>   }
>   if (VFSFileOpen(refNum, "TEST.TXT", vfsModeRead, &file)==errNone) {
>    VFSFileSize(file, &numBtW);
>    StrPrintF(msg,"Size : %d",numBtW);
>    Echo(field,msg);
>    VFSFileClose(file);
>   }
>  }
>  else
>   Echo(field,"No stick");
> }
> 
> 
> static Err MStickRefNum(UInt16 *refNum)
> {
>  Err err;
>  UInt32 vfsMgrVersion;
>  UInt32 volIterator;
> 
>  VolumeInfoTag volInfo;
> 
>  err = FtrGet(sysFileCVFSMgr, vfsFtrIDVersion, &vfsMgrVersion);
>  if (err == errNone) {
>   volIterator = vfsIteratorStart;
>   do {
>    if (VFSVolumeEnumerate(refNum, &volIterator)==errNone) {
>     err=VFSVolumeInfo(*refNum, &volInfo);
>    }
>   } while ((err==errNone) &&
>     (volIterator!=vfsIteratorStop) &&
>     (volInfo.mediaType!=expMediaType_MemoryStick));
>  }
>  return (volInfo.mediaType==expMediaType_MemoryStick) ? errNone : 
> ! errNone;
> }
> 
> 
> 
> 
> 
> -- 
> For information on using the Palm Developer Forums, or to 
> unsubscribe, please see http://www.palmos.com/dev/support/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