www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/06/18/05:33:56

Message-ID: <3D0EF1F1.1070202@eik.bme.hu>
Date: Tue, 18 Jun 2002 10:40:17 +0200
From: =?ISO-8859-2?Q?=22Dr=2E_Andr=E1s_S=F3lyom=22?= <solyom AT eik DOT bme DOT hu>
Organization: none
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.0.0) Gecko/20020530
X-Accept-Language: hu,en
MIME-Version: 1.0
To: djgpp AT delorie DOT com
Subject: Re: MSDOS/stat() reporting wrong size
References: <WtBP8.784$dV5 DOT 64766992 AT newssvr13 DOT news DOT prodigy DOT com>
Reply-To: djgpp AT delorie DOT com

Matthew Mucklo wrote:

>Hello,
>
>I was wondering if anyone knew why MSDOS and stat() therefore return the
>wrong file size.  fread() appears to finish ahead of the end of the file as
>according to stat().  It's reporting less characters read than are actually
>in the file (yes, the buffer's big enough).
>
>  
>
I think the probeem is that you want to read an MSDOS TEXT file 
containing CR\LF pairs which are converted upon reading to a single LF. 
Modify this line

>    fd = fopen(argv[1], "r");
>
Open the file in binary mode like    

	fd = fopen(argv[1], "rb");



- Raw text -


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