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

  1. Xref: sparky comp.lang.c:19339 comp.os.vms:20470
  2. Newsgroups: local.unix.help,comp.lang.c,comp.os.vms
  3. Path: sparky!uunet!newsflash.concordia.ca!mizar.cc.umanitoba.ca!kaarts
  4. From: kaarts@ccu.umanitoba.ca (Kenneth John Aarts)
  5. Subject: Re: Using C to read Fortran Files
  6. Message-ID: <C0GHCC.Cwp@ccu.umanitoba.ca>
  7. Sender: news@ccu.umanitoba.ca
  8. Nntp-Posting-Host: ccu.umanitoba.ca
  9. Organization: University of Manitoba, Winnipeg, Canada
  10. References: <C0Fyo3.70D@ccu.umanitoba.ca> <C0G1rw.81L@ccu.umanitoba.ca>
  11. Date: Wed, 6 Jan 1993 23:31:24 GMT
  12. Lines: 39
  13.  
  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. Thanks again,
  51.  
  52. Ken
  53.