[prog] FORTRAN read with dos carriage returns

Conor Daly c.daly at met.ie
Wed Oct 5 20:30:12 EST 2005


On Wed, Oct 05, 2005 at 01:44:48AM +-0200 or thereabouts, Almut Behrens wrote:
> 
> g77 should support fgetc(), so you could basically do it as you would in C.
> The sample code below simply skips all +AFw-r's and should thus work with
> both +AFw-n or +AFw-r+AFw-n terminated lines in the input files.
> (tested with g77 v3.3.4 -- probably not portable to any other compiler)

Thanks Almut!  Quick response and spot on...
 
> BTW, this ugly assembly language like test-and-jump technique of flow
> control is certainly not the state of art of Fortran programming...
> (you'll likely know how to do it properly)  But mind you, my Fortran
> knowledge is more than rusty, and right now I don't feel any need to
> polish it ;)

I feel as much need as you to polish my Fortran!!  I'm in the happy(?)
position of having inherited a set of Fortran programs which have, at best,
as much commentary as you've put in your sample!!  I'll try to understand
them and convert them to well-commented C as I go.  Shouldn't take me more
than about 5 years or so...
 
>         if (ret == -1)    goto 999  ! eof

Interestingly, g77 accepts this but the Portland fortran compiler (which we
use on those sources that g77 doesn't like) hates it.  It appears to accept
the fgetc() call though...

Conor
-- 
Conor Daly,                   Please avoid sending me 
Met Eireann, Glasnevin Hill,  Word or PowerPoint attachments.
Dublin 9, Ireland             http://www.fsf.org/philosophy/no-word-attachments.html
Ph +-3531 8064276 Fax +-3531 8064247

*********************************************************************************
This e-mail and any files transmitted with it are confidential and intended solely for the addressee. If you have received this email in error please notify the sender.
This e-mail message has also been scanned for the presence of computer viruses.

T+AOE an r+AO0-omhphost seo, agus aon chomhad at+AOE nasctha leis, faoi r+APo-n agus is don t+AOk a seoladh chuige amh+AOE-in +AOk. M+AOE tharla go bhfuair t+APo an r+AO0-omhphost seo tr+AO0 dhearmad cuir in i+APo-l don t+AOk a sheol +AOk led+IBk thoil.

T+AOE an teachtaireacht r+AO0-omhphoist seo scuabtha le bogearra+AO0 frithv+AO0-reas.
********************************************************************************



More information about the Programming mailing list