51MB size limit with fopen in append mode

From: Aaron Couts (spam_at_couts.org)
Date: 02/25/04


Date: Wed, 25 Feb 2004 19:42:47 GMT

I have a program that writes to a log file. It's compiled on RH Linux 7.3
(Kernel 2.4.18-18.7). It's using fopen in append mode. When the file reaches
51200000 bytes in size, the program will no longer write to the file. When
this happens, fopen and fputs do not return an error. I've been researching
large file support for Linux, and it all has to do with the regular 2-gig file
size limit. If it's something obvious, sorry -- I'm a C newbie. Here's the
code snippet:

  /* open logfile */
  if ((lop = fopen(log, "a")) == NULL) {
    fprintf(op, "\n%s: can't open %s for writing\n", prog, log);
    fclose(op);
    exit(1);
  }

  /* write To: line to logfile */
  fputs(outputline, lop);
  fclose(lop);
  if (ferror(lop)) {
    fprintf(op, "\n%s: error writing to %s\n", prog, log);
  }

I'm all ears if anyone has any suggestions. Thanks.
-Aaron

-- 
To contact me via email, substitute 
'aaron' for 'spam' in my address.
http://www.towerdata.com


Relevant Pages