c program, file size limit, how to solve? 2G bytes limit.

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);

}
------------------------------
 
V

Victor Bazarov

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"?

Uh... Your problem seems to be either of the "C" sort (in that case ask
in comp.lang.c, down the hall) or of the "GCC" sort (in that case ask in
gnu.gcc.help, around the corner). In either case, I don't see a C++ one.

V
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top