fopen file size error when file size is over around 6MB

Chan Kim ckim at
Tue Sep 8 04:47:35 UTC 2015

Hello, rtems users,

After mounting SD card under /mnt, I can read and write files now. But when the file size is bigger than 5Mbytes, the file size information reads wrong. If it's less than 5Mbytes, read and write is ok.

For example, when the file size is 10MByte,
            fpsrc = fopen("/mnt/dir2/sample10m.dat","r");
            fseek(fpsrc, 0L, SEEK_END);
            size = ftell(fpsrc);
            printk("numbytes = %d\n", size);
            fseek(fpsrc, 0L, SEEK_SET);
result : 
            numbytes = 4194304     <=== this is exactly 4MByte (when the file size is 10MB)

Is there something I should set for IMFS configuration? 
I see (#define MSDOS_MAX_FILE_SIZE                0xFFFFFFFF) in msdos.h.



More information about the users mailing list