Opening Large (24 GB) File In C
Posted
by zacaj
on Stack Overflow
See other posts from Stack Overflow
or by zacaj
Published on 2009-10-14T20:39:06Z
Indexed on
2010/04/17
1:13 UTC
Read the original article
Hit count: 271
I'm trying to read in a 24 GB XML file in C, but it won't work. I'm printing out the current position using ftell() as I read it in, but once it gets to a big enough number, it goes back to a small number and starts over, never even getting 20% through the file. I assume this is a problem with the range of the variable that's used to store the position (long), which can go up to about 4,000,000,000 according to http://msdn.microsoft.com/en-us/library/s3f49ktz%28VS.80%29.aspx, while my file is 25,000,000,000 bytes in size. A long long should work, but how would I change what my compiler(Cygwin/mingw32) uses or get it to have fopen64?
© Stack Overflow or respective owner