home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / lang / c / 19385 < prev    next >
Encoding:
Internet Message Format  |  1993-01-07  |  2.2 KB

  1. Xref: sparky comp.lang.c:19385 comp.os.vms:20540
  2. Path: sparky!uunet!think.com!sdd.hp.com!ux1.cso.uiuc.edu!usenet.ucs.indiana.edu!indyvax.iupui.edu!harvey
  3. From: harvey@indyvax.iupui.edu
  4. Newsgroups: comp.lang.c,comp.os.vms
  5. Subject: Re: Using C to read Fortran Files
  6. Message-ID: <1993Jan7.184438.220@indyvax.iupui.edu>
  7. Date: 7 Jan 93 18:44:38 -0500
  8. References: <C0Fyo3.70D@ccu.umanitoba.ca> <C0G1rw.81L@ccu.umanitoba.ca> <C0GHCC.Cwp@ccu.umanitoba.ca>
  9. Followup-To: comp.os.vms
  10. Organization: Indiana University-Purdue University at Indianapolis
  11. Lines: 54
  12.  
  13. In article <C0GHCC.Cwp@ccu.umanitoba.ca>, kaarts@ccu.umanitoba.ca (Kenneth John Aarts) writes:
  14. > In <C0G1rw.81L@ccu.umanitoba.ca> kaarts@ccu.umanitoba.ca (Kenneth John Aarts) writes:
  15. >
  16. >>I have a fortran program that does essentially
  17. >
  18. >>    open(unit=1,"test",status='new')
  19. >>    write(1,10) 'cArt'
  20. >>10    format(a4)
  21. >>    end
  22. >
  23. >>and then a C program that reads it:
  24. >
  25. >>    int d1,d2,d3,d4,d5;
  26. >>    FILE *fp;
  27. >>    fp=fopen("test","r");
  28. >>    fscanf(fp,"%c%c%c%c%c",&d1,&d2,&d3,&d4,&d5);
  29. >>    printf("%d %d %d %d %d\n",d1,d2,d3,d4,d5);
  30. >
  31. >>The output of the C program is:
  32. >
  33. >>  10  65  114  116   13
  34. >
  35. >>  LF  A    r   t    CR
  36. >
  37. >>However, a fortran program reading the test program does see cArt.
  38. >
  39. > A little more information:
  40. >
  41. > This is all done on VMS.  The fortran created file has a 'fortran carriage
  42. > control' record attribute.
  43. >
  44. > I do not have the option of rewriting the fortran code to add carriage
  45. > control to the format statement.
  46. >
  47. > I need a way to convince VMS not to interpret the file before sending it's
  48. > contents to the C program.
  49.  
  50. VMS isn't, RMS is.
  51.  
  52. > Thanks again,
  53. >
  54. > Ken
  55.  
  56. If you can't change either program, and your C program must be able to see
  57. the actual FORTRAN carraige control characters, you can use something like
  58. Joe Meadow's FILE utility to clear FORTRAN carriage control record attribute
  59. in the file's header.  Then the out-of-band data (the actual FORTRAN carriage-
  60. control characters) will be read as part of the record data.
  61.  
  62. Since this question has nothing at all to do with Unix, followups have been
  63. directed to comp.os.vms ONLY...
  64. --
  65. James Harvey    IUPUI OIT Technical Support/Networks
  66. harvey@iupui.edu  harvey@indiana.edu  uucp:iugate!harvey  bitnet:harvey@indyvax
  67.