1

Possible Duplicate:
2GB limit on file size when using fwrite in C?

I realized that for my C compiler, the fread function can only correctly read a file smaller than 2GB (2147483648). I am wondering whether we could read >2GB file at all. Thanks

Community
  • 1
  • 1
Hailiang Zhang
  • 17,604
  • 23
  • 71
  • 117
  • It might be possible to use open() and read() with int file descriptors instead of fopen() and fread() with FILE pointers. It's likely that the FILE structure is the source of your 32-bit limitations, and repeated read() calls will work no matter how big the file is. – NovaDenizen Sep 05 '12 at 00:08

1 Answers1

3

You need to compile with large file support. Alternatively, on some platforms you can use fopen64.

ecatmur
  • 152,476
  • 27
  • 293
  • 366