home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.lang.c:19385 comp.os.vms:20540
- Path: sparky!uunet!think.com!sdd.hp.com!ux1.cso.uiuc.edu!usenet.ucs.indiana.edu!indyvax.iupui.edu!harvey
- From: harvey@indyvax.iupui.edu
- Newsgroups: comp.lang.c,comp.os.vms
- Subject: Re: Using C to read Fortran Files
- Message-ID: <1993Jan7.184438.220@indyvax.iupui.edu>
- Date: 7 Jan 93 18:44:38 -0500
- References: <C0Fyo3.70D@ccu.umanitoba.ca> <C0G1rw.81L@ccu.umanitoba.ca> <C0GHCC.Cwp@ccu.umanitoba.ca>
- Followup-To: comp.os.vms
- Organization: Indiana University-Purdue University at Indianapolis
- Lines: 54
-
- In article <C0GHCC.Cwp@ccu.umanitoba.ca>, kaarts@ccu.umanitoba.ca (Kenneth John Aarts) writes:
- > 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.
-
- VMS isn't, RMS is.
-
- > Thanks again,
- >
- > Ken
-
- If you can't change either program, and your C program must be able to see
- the actual FORTRAN carraige control characters, you can use something like
- Joe Meadow's FILE utility to clear FORTRAN carriage control record attribute
- in the file's header. Then the out-of-band data (the actual FORTRAN carriage-
- control characters) will be read as part of the record data.
-
- Since this question has nothing at all to do with Unix, followups have been
- directed to comp.os.vms ONLY...
- --
- James Harvey IUPUI OIT Technical Support/Networks
- harvey@iupui.edu harvey@indiana.edu uucp:iugate!harvey bitnet:harvey@indyvax
-