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

Chan Kim ckim at etri.re.kr
Tue Sep 8 07:53:00 UTC 2015


> Which information do you get via fstat()?
There was a mistake (I read 4MB file when I thought 10MB file), now it copies the file (read and write) ok.
But I don't know why the fstat function returns -1 below.

--------
            fpsrc = fopen("/mnt/dir2/sample10m.dat","r");

    struct stat stat1;
            fseek(fpsrc, 0L, SEEK_END);
            size = ftell(fpsrc);
            printk("numbytes = %d\n", size);
    int res = fstat(fpsrc, &stat1);
    printk("----- print fstat result ..res = %d----- \n", res);
    printk(" st_uid = %x\n", stat1.st_uid);
    printk(" st_gid = %x\n", stat1.st_gid);
    printk(" st_size = %x\n", stat1.st_size);
    printk(" st_blksize = %x\n", stat1.st_blksize);
    printk(" st_blocks = %x\n", stat1.st_blocks);


numbytes = 10485760
----- print fstat result ..res = -1----- 
 st_uid = 9E68
 st_gid = E1A9
 st_size = 92826906
 st_blksize = 1E415858
 st_blocks = 4FCAA458
----- now copying..(10485760 bytes)
10485760 bytes copied

Thanks.

Chan


보낸 사람 : "Sebastian Huber" <sebastian.huber at embedded-brains.de>
보낸 날짜 : 2015-09-08 14:42:00 ( +09:00 )
받는 사람 : users at rtems.org <users at rtems.org>
참조 : 
제목 : Re: fopen file size error when file size is over around 6MB

Which information do you get via fstat()?

On 08/09/15 06:47, Chan Kim wrote:
> 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.
>
> Thanks,
>
> Chan
> _______________________________________________
> users mailing list
> users at rtems.org
> http://lists.rtems.org/mailman/listinfo/users

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail : sebastian.huber at embedded-brains.de
PGP : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.

_______________________________________________
users mailing list
users at rtems.org
http://lists.rtems.org/mailman/listinfo/users


More information about the users mailing list