consider this test program:
#include <stdio.h>
int main( int argc, char* argv )
{
FILE * file;
if( ( file = fopen( "/home/cucuioan/bigfiledump", "w" ) ) == NULL ){
printf("Unable to open file
" );
return 1;
}
char bigbuff[1024*1024];
for( int i = 0; i < 3000; ++i ){
fwrite( bigbuff, 1024*1024, 1, file );
printf("Dumped so far: %d
", i * 1024*1024 );
}
printf("Finished dumping
");
fclose(file);
*/
}
Of course, when it reaches the 2^32 - 1 upper limit I end up with an “File size limit exceeded”
I did a bit of searching and found out that I have to enable large file support to be able to use larger files in my program.
Now, another wierd thing is that if I write this:
int main( int argc, char* argv )
{
FILE*f;
printf( "sizeof off_t : %d
", sizeof(off_t) );
fseeko(f, 0, 0 );
}
i get an undefined type off_t, altough looking at fseeko’s man page the off_t type is specified and the only header that need s to be included is stdio.h. Grepping through /usr/include I found the __off_t type, but this has only 4 bytes size and that is not enough… I belive that if I switch to LFS this type will become 8 bytes wide… Even thow, why is off_t undefined?
So… how do I enable LFS in OpenSuse 10? I tried the -D_FILE_OFFSET_BITS=64 but it doesn’t work…
any advice or explanation would be welcomed…
thx in advance