home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.lang.c:19339 comp.os.vms:20470
- Newsgroups: local.unix.help,comp.lang.c,comp.os.vms
- Path: sparky!uunet!newsflash.concordia.ca!mizar.cc.umanitoba.ca!kaarts
- From: kaarts@ccu.umanitoba.ca (Kenneth John Aarts)
- Subject: Re: Using C to read Fortran Files
- Message-ID: <C0GHCC.Cwp@ccu.umanitoba.ca>
- Sender: news@ccu.umanitoba.ca
- Nntp-Posting-Host: ccu.umanitoba.ca
- Organization: University of Manitoba, Winnipeg, Canada
- References: <C0Fyo3.70D@ccu.umanitoba.ca> <C0G1rw.81L@ccu.umanitoba.ca>
- Date: Wed, 6 Jan 1993 23:31:24 GMT
- Lines: 39
-
- In <C0G1rw.81L@ccu.umanitoba.ca> kaarts@ccu.umanitoba.ca (Kenneth John Aarts) writes:
-
- >I have a fortran program that does essentially
-
- > open(unit=1,"test",status='new')
- > write(1,10) 'cArt'
- >10 format(a4)
- > end
-
- >and then a C program that reads it:
-
- > int d1,d2,d3,d4,d5;
- > FILE *fp;
- > 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
-
- > LF A r t CR
-
- >However, a fortran program reading the test program does see cArt.
-
- A little more information:
-
- This is all done on VMS. The fortran created file has a 'fortran carriage
- control' record attribute.
-
- I do not have the option of rewriting the fortran code to add carriage
- control to the format statement.
-
- I need a way to convince VMS not to interpret the file before sending it's
- contents to the C program.
-
- Thanks again,
-
- Ken
-