delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/11/08/09:46:05

Date: Wed, 8 Nov 1995 13:20:57 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: "Alexander V. Lukyanov" <lav AT video DOT yars DOT free DOT net>
Cc: lav AT yars DOT free DOT net, djgpp AT sun DOT soe DOT clarkson DOT edu, jkmarsha AT socs DOT uts DOT edu DOT au,
kagel AT ts1 DOT bloomberg DOT com, DJ Delorie <dj>
Subject: Re: CR/LF pairs... NO NO NO!

On Wed, 8 Nov 1995, Alexander V. Lukyanov wrote:

> Well, I have just seen sources of libc for djgpp, and I've found,
> that djgpp has the same bug I described before. Stdio converts
> text back to raw format to calculate ftell(),
> and if text in buffer contained plain '\n' then single '\n' will
> be converted to two characters "\r\n". This is wrong, because
> '\n' could be get from "\r\n" and from single '\n'.
> This is why ftell() can tell wrong value.

Did you try this lately with a test program?  I didn't, but at least 
looking at the library sources shows that ftell() indeed assumes there 
was a CR for every LF, but fseek() makes the same assumption, so if you 
only call fseek() with values returned by ftell(), they should work.

- Raw text -


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