www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/10/23/11:25:16

Date: Wed, 23 Oct 1996 15:14:30 -0300
Message-Id: <1.5.4.16.19961023131119.379fc110@dmeasc.rc.ipt.br>
Mime-Version: 1.0
To: degiorgi AT inf DOT ethz DOT ch, djgpp AT delorie DOT com
From: Cesar Scarpini Rabak <csrabak AT dce03 DOT ipt DOT br>
Subject: Re: ftell does'nt work properly

At 15:35 21/10/96 GMT, Daniele Degiorgi wrote:
>Some times ago I had the same problem:
>
>Developping a small compiler I used a big file as a source library.
>When I encountered an include statement within a module, I used
>to save the actual position with ftell(), reading the included 
>module and at the end of this I used fseek to resume reading
>at the proper place.
>I had a first problem with a module in the library containing
>a single cr (0x0D). This seems to disturb all compilers I used
>(Borland C++, Visual C++ and djgpp). After fixing it (replacing
>it by blank in the file) all worked good with Borland C++ and 
>Visual C++, but I still had problems with djgpp.
>
>The final solution was to use different FILE variables reopening
>the library file for each include and avoiding pairing of ftell/fseek.
>
>The troubles caused by the presence of the character 0x0D are dued
>to the fact that the ftell routine counts the presence of single
>chars and not pairs of cr/lf. But, as the different documentations
>warns about malfunctioning in case of presence of nonprintable characters
>in text files, this may be ok.
>
>In each case now I always try to avoid the usage of ftell/fseek in 
>conjunction with DOS text files.
>
>
>Daniel
>
>
BTW all MS-DOG compiler documentations have this advise, so this is not a
DJGPP (specific) issue...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Cesar Scarpini Rabak                      E-mail: csrabak AT ipt DOT br
DME/ASC                                   Phone: 55-11-268-35221Ext.350
IPT - Instituto de Pesquisas Tecnologicas Fax:   55-11-268-5996
Av. Prof. Almeida Prado, 532.  Sao Paulo - SP 05508-901 BRAZIL
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- Raw text -


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