www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/08/14/17:44:05

Message-ID: <32124686.3395@pobox.oleane.com>
Date: Wed, 14 Aug 1996 23:35:02 +0200
From: Francois Charton <deef AT pobox DOT oleane DOT com>
Organization: CCMSA
MIME-Version: 1.0
To: Joonas W N Reynders <reynders AT cc DOT helsinki DOT fi>
CC: djgpp AT delorie DOT com
Subject: Re: Does FREAD have a limitation?
References: <4urt38$f7h AT oravannahka DOT Helsinki DOT FI>

Joonas W N Reynders wrote:
> 
>         My question is that does fread have a limit in the number of
> bytes it can read on one call? If I try to read more than about 130000
> bytes I get EOF on a file which is 890000 bytes long (read starts from
> the beginning, I've checked it with ftell). The size of read unit is one
> byte.

No. I checked the source for fread (in DJGPP/SRC/LIBC/ANSI/STDIO), which 
does not limit in any way the number of bytes read. Also, I wrote a small 
program which smoothly read 1000000 bytes with one fread().

What did you use to open your file ?
It should be
fopen("myfile.sth","rb");
                   ^^^^^
on my machine, if you say :
fopen("myfile.sth","r");
                  ^^^^^ 
your file is opened as a text file, and fread() does not work as you 
wish... (I think this default attitude can be corrected by fixinf 
something in a .h header).^

Francois,

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019