Re: Read DOS or Unix files with the same fortran code



On Nov 27, 11:54 am, feenb...@xxxxxxxxx wrote:
I would like my fortran program to be able to read text files with
either Unix or DOS line endings..

The read is free format. (read(*,*) (x(i),i=1,22).
The compiler is gcc version 3.4.6 [FreeBSD] 20060305
The OS is FreeBSD 6.2
Code is standard F77

Is there an option I could set or another compiler that I could use
that would allow the stray contol-Ms in DOS formatted files without
getting upset? I understand that I could preprocess DOS files with
dos2unix, but that adds complications I would prefer to avoid.

Thank you
Daniel Feenberg
National Bureau of Economic Research
feenberg at nber dotte org

Whenever I meet this problem I use Wordstar in text mode to read the
file and then change
^M^J to ^J for unix, or
^J to ^M^J for DOS
It's one single operation. Wordstar may pause on very large files, but
there is a control to "write-to-cursor" (what is current) and
"continue reading" (to get some more) which allows unlimited size
files, unlike EDIT and many other editors.

.



Relevant Pages

  • Re: Read DOS or Unix files with the same fortran code
    ... either Unix or DOS line endings.. ... The read is free format. ... The compiler is gcc version 3.4.6 [FreeBSD] 20060305 ... Is there an option I could set or another compiler that I could use ...
    (comp.lang.fortran)
  • Re: Read DOS or Unix files with the same fortran code
    ... either Unix or DOS line endings.. ... The read is free format. ... The compiler is gcc version 3.4.6 [FreeBSD] 20060305 ... Is there an option I could set or another compiler that I could use ...
    (comp.lang.fortran)
  • Re: Read DOS or Unix files with the same fortran code
    ... either Unix or DOS line endings.. ... The read is free format. ... The compiler is gcc version 3.4.6 [FreeBSD] 20060305 ... Is there an option I could set or another compiler that I could use ...
    (comp.lang.fortran)
  • Re: Read DOS or Unix files with the same fortran code
    ... either Unix or DOS line endings.. ... The read is free format. ... The compiler is gcc version 3.4.6 [FreeBSD] 20060305 ... Is there an option I could set or another compiler that I could use ...
    (comp.lang.fortran)
  • Re: Bug/problem with lcc-win
    ... layer or through using a sufficiently old version of win32, ... which is a 16 bit DOS emulation mode (which does ... Who writes a Win32 compiler and is ... unfamiliar with the basic execution modes of Windows? ...
    (comp.lang.c)