home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: local.unix.help,comp.lang.c
- Path: sparky!uunet!newsflash.concordia.ca!mizar.cc.umanitoba.ca!kaarts
- From: kaarts@ccu.umanitoba.ca (Kenneth John Aarts)
- Subject: Using C to read Fortran Files
- Message-ID: <C0Fyo3.70D@ccu.umanitoba.ca>
- Sender: news@ccu.umanitoba.ca
- Nntp-Posting-Host: ccu.umanitoba.ca
- Organization: University of Manitoba, Winnipeg, Manitoba, Canada
- Date: Wed, 6 Jan 1993 16:48:02 GMT
- Lines: 29
-
-
- 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?
-
- Thanks,
-
- Ken
-