Mail Archives: cygwin/2002/06/13/18:17:02
----- Original Message -----
From: "Xinan Zhou" <zhoux AT lifepredictiontech DOT com>
To: <cygwin AT cygwin DOT com>
Sent: Thursday, June 13, 2002 3:39 PM
Subject: Re: [Fwd: fortran read problem]
> RE: [Fwd: fortran read problem]Hi, Mark, thank you very much for your
message.
>
> I tried your code with 3 data files that contain the same two line
data but
> edited with cat, vi, and Notepad respectively. And found that only the
data
> file edited by vi gives the correct results for two lines. The other
two only > give the correct results for the last line. I did not hit the
'return key' at > the end of last line for all 3 data files.
>
> It seems fortran read on cygwin interpret the end of line differently
for data > files edited by cat and Notepad.
>
> Mark's code and test files are attached.
>
> Again, thanks for Mark's help.
>
> Xinan
I generated that version of the code at work and would almost
bet money that it worked correctly for me with a Notepad generated
file... I'll have to check when I get back to work tomorrow...
Meanwhile...
If you apply the following fix to the code, it should
fix your problem...
The "trick" is to check for the problem character at
the end of the line :
if(ICHAR(text(i:i)).NE.13) then
--Mark
stuckymb [522] > diff orig_test_read.f test_read.f
33a34
> integer ic
36a38
> character*1 ch
89c91,101
< if(j.le.40) textpart(n)(j:j)=text(i:i)
---
> if(j.le.40) then
> if(ICHAR(text(i:i)).NE.13) then
> textpart(n)(j:j)=text(i:i)
> else
> ch = text(i:i)
> ic = ICHAR(ch)
> write(*,'('' text('',I2,'') : ICHAR = '',I3,
> : 2x,'' J = '',I3)')
> : i,ic,j
> endif
> endif
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
- Raw text -