🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #13181

Limit of fopen and/or fread

#13181
From: Mike King
Date: Fri, 24 Oct 2003 04:01
20 lines
1475 bytes
I'm writing a program that uses fopen() and fread() but I'm having a
problem.  The program only sees a total of 336,058 bytes of a file that is
51,693,886 bytes.  Am I doing something wrong?  BTW, I'm using fopen()
because I'm going to build the program on Linux in addition to Windows.

   FILE *fp;
   const int read_chunk_size = 16384;
   char buf[read_chunk_size];
   unsigned int bytes_read;
   int  total_bytes = 0;
   fp = fopen(filename,"rt");

   do
   {
      bytes_read = fread(buf,1,read_chunk_size,fp);
      total_bytes += bytes_read;
   }
   while (bytes_read == read_chunk_size);

   fclose(fp);
Technical Details
Message-ID: <3f98a40e$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,2167243a1bc457e4,start
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-10-23 21:09:07 PST
From: "Mike King" <emailMK@excite.com>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Limit of fopen and/or fread
Date: Fri, 24 Oct 2003 00:01:47 -0400
Lines: 22
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 68.34.75.85
Message-ID: <3f98a40e$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1066968078 68.34.75.85 (23 Oct 2003 21:01:18 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail