Mail Archives: cygwin/2004/09/01/05:58:36
Dear colleagues,
I encountered some unexpected problems when opening a data file in a
FORTRAN program and reading characters from it. I work on WINDOWS XP and
I downloaded today the latest version of cygwin from
http://sources.redhat.com/cygwin/. g77 claims to be version 3.3.3
The problem which can be reproduced by the small program attached occurs
only when I open the file (test.dat is assumed here to reside in the
root directory of drive d) with an absolute path in the form
'd:/test.dat' and when the read format is '(A)'. In this case, the
output consists of three empty lines only. Not even the "read:" is
printed. The problem does not occur when I use '/cygdrive/d/test.dat' to
open the file or when the read format contains explicitly the correct
length of the line. It is apparent that the data file is found and
opened since the number of lines found during reading corresponds to the
actual number of lines in the file.
Any help would be welcome.
Kind regards,
Peter Pichler
===== test.f start =====
PROGRAM TEST
CHARACTER*256 STRVAL
CHARACTER*72 ZEI
C--- this works:
C OPEN (UNIT=21,FILE=
C 1 'd:/test.dat',
C 2 STATUS='OLD')
C
C 10 READ (21,'(A6)',END=30,ERR=30) ZEI
C write (*,'(T2,''read: '',A)') zei
C GOTO 10
C--- this works:
C OPEN (UNIT=21,FILE=
C 1 '/cygdrive/d/test.dat',
C 2 STATUS='OLD')
C
C 10 READ (21,'(A)',END=30,ERR=30) ZEI
C write (*,'(T2,''read: '',A)') zei
C GOTO 10
C--- the combination does'nt work:
OPEN (UNIT=21,FILE=
1 'd:/test.dat',
2 STATUS='OLD')
10 READ (21,'(A)',END=30,ERR=30) ZEI
write (*,'(T2,''read: '',A)') zei
GOTO 10
30 CONTINUE
CLOSE(21)
END
===== test.f end =====
===== test.dat start =====
line 1
line 2
line 3
===== test.dat end =====
--
Dr. Peter Pichler Tel.: +49 (0) 9131 761-227
Fraunhofer IISB Fax : +49 (0) 9131 761-212
Schottkystrasse 10 mailto:peter DOT pichler AT iisb DOT fraunhofer DOT de
91058 Erlangen, Germany http://www.iisb.fraunhofer.de
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
- Raw text -