Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > c program, file size limit, how to solve? 2G bytes limit.

Reply
Thread Tools

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

 
 
guru.slt@gmail.com
Guest
Posts: n/a
 
      06-27-2005
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[i] = 'a';
buffer[i] = '\n';

while(1)
fwrite(buffer, 1, 2281, f_p);

}
------------------------------

 
Reply With Quote
 
 
 
 
Victor Bazarov
Guest
Posts: n/a
 
      06-27-2005
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
When using System.IO.FileStream, I write 8 bytes, then seek to the start of the file, does the 8 bytes get flushed on seek and the buffer become a readbuffer at that point instead of being a write buffer? DR ASP .Net 2 07-29-2008 09:50 AM
Could a struct with size 44 bytes point always points to a char array with size 2024 bytes? eagle_jyjh@citiz.net C++ 8 04-10-2006 03:05 PM
Could a struct with size 44 bytes point always points to a char array with size 2048 bytes? eagle_jyjh@citiz.net C Programming 5 04-09-2006 02:49 PM
Why file containing 256 bytes is 257 bytes long? Yandos C++ 12 09-14-2005 11:53 PM



Advertisments