G
guru.slt
my c program fails to write file that is bigger than 2G bytes. I used
gcc compiler. After writing for a while, It says: "filesize limit
exceed". How to solve this?
But, if I compile the c code by "c++", then it can write more than 2G
bytes in a file. Where is the problem for "gcc"?
the code is here:
---------------------------
#include <stdio.h>
#include <string.h>
int main()
{
char buffer[2281];
FILE* f_p;
f_p = fopen("output.vi", "w");
int i;
for (i = 0; i < 2280; ++i) buffer = 'a';
buffer = '\n';
while(1)
fwrite(buffer, 1, 2281, f_p);
}
------------------------------
gcc compiler. After writing for a while, It says: "filesize limit
exceed". How to solve this?
But, if I compile the c code by "c++", then it can write more than 2G
bytes in a file. Where is the problem for "gcc"?
the code is here:
---------------------------
#include <stdio.h>
#include <string.h>
int main()
{
char buffer[2281];
FILE* f_p;
f_p = fopen("output.vi", "w");
int i;
for (i = 0; i < 2280; ++i) buffer = 'a';
buffer = '\n';
while(1)
fwrite(buffer, 1, 2281, f_p);
}
------------------------------