delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/09/01/05:58:36

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-ID: <41359D42.2080709@iisb.fraunhofer.de>
Date: Wed, 01 Sep 2004 11:58:26 +0200
From: "Dr. Peter Pichler" <peter DOT pichler AT iisb DOT fraunhofer DOT de>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de-AT; rv:1.6) Gecko/20040113
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: FORTRAN open/read problem with drive letters
X-IsSubscribed: yes

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 -


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