home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.lang.c:19328 comp.os.vms:20460
- Path: sparky!uunet!paladin.american.edu!gatech!usenet.ins.cwru.edu!agate!doc.ic.ac.uk!uknet!miclon!nreadwin
- From: nreadwin@micrognosis.co.uk (Neil Readwin)
- Newsgroups: local.unix.help,comp.lang.c,comp.os.vms
- Subject: Re: Using C to read Fortran Files
- Message-ID: <C0GAn3.55z@micrognosis.co.uk>
- Date: 6 Jan 93 21:06:39 GMT
- References: <C0Fyo3.70D@ccu.umanitoba.ca> <C0G1rw.81L@ccu.umanitoba.ca>
- Sender: news@micrognosis.co.uk
- Organization: Micrognosis, a division of CSK(UK) Ltd
- Lines: 29
-
- kaarts@ccu.umanitoba.ca (Kenneth John Aarts) writes:
- |> [...]
- |> > write(1,10) 'cArt'
- |> >10 format(a4)
- |> [...]
- |> > fp=fopen("test","r");
- |> > fscanf(fp,"%c%c%c%c%c",&d1,&d2,&d3,&d4,&d5);
- |> > printf("%d %d %d %d %d\n",d1,d2,d3,d4,d5);
- |>
- |> >The output of the C program is:
- |> > 10 65 114 116 13
- |> [...]
- |> This is all done on VMS. The fortran created file has a 'fortran carriage
- |> control' record attribute.
-
- Something (my guess would be the VAX C RTL) is carefully stripping out the
- carraige control character ('c') and replacing it with what it thinks is the
- appropriate carraige control (precede with LF and append CR). Indeed, if
- you change the 'c' to say '1' or '-' then you will get a different result.
-
- If you change the fopen() call to be:
- fp=fopen("test","r","ctx=nocvt");
- then you will get the 'c'. However, note that '1' will still be converted to
- form-feed. Gak!
-
- This is VMS specific, so followups to comp.os.vms only please. Neil.
- --
- Phone: +44 71 815 5283 E-mail: nreadwin@micrognosis.co.uk
- Anything is a cause for sorrow that my mind or body has made
-