home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.lang.c:19319 comp.os.vms:20449
- Newsgroups: local.unix.help,comp.lang.c,comp.os.vms
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!caen!destroyer!cs.ubc.ca!utcsri!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: <C0G1rw.81L@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>
- Date: Wed, 6 Jan 1993 17:55:06 GMT
- Lines: 32
-
- In <C0Fyo3.70D@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.
-
- >How do I get C to find the c in cArt?
-
- A little more information:
-
- This is all done on VMS. The fortran created file has a 'fortran carriage
- control' record attribute.
-