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

  1. Xref: sparky comp.lang.c:19319 comp.os.vms:20449
  2. Newsgroups: local.unix.help,comp.lang.c,comp.os.vms
  3. Path: sparky!uunet!zaphod.mps.ohio-state.edu!caen!destroyer!cs.ubc.ca!utcsri!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: <C0G1rw.81L@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>
  11. Date: Wed, 6 Jan 1993 17:55:06 GMT
  12. Lines: 32
  13.  
  14. In <C0Fyo3.70D@ccu.umanitoba.ca> kaarts@ccu.umanitoba.ca (Kenneth John Aarts) writes:
  15.  
  16.  
  17. >I have a fortran program that does essentially
  18.  
  19. >    open(unit=1,"test",status='new')
  20. >    write(1,10) 'cArt'
  21. >10    format(a4)
  22. >    end
  23.  
  24. >and then a C program that reads it:
  25.  
  26. >    int d1,d2,d3,d4,d5;
  27. >    FILE *fp;
  28. >    fp=fopen("test","r");
  29. >    fscanf(fp,"%c%c%c%c%c",&d1,&d2,&d3,&d4,&d5);
  30. >    printf("%d %d %d %d %d\n",d1,d2,d3,d4,d5);
  31.  
  32. >The output of the C program is:
  33.  
  34. >  10  65  114  116   13
  35.  
  36. >  LF  A    r   t    CR
  37.  
  38. >However, a fortran program reading the test program does see cArt.
  39.  
  40. >How do I get C to find the c in cArt?
  41.  
  42. A little more information:
  43.  
  44. This is all done on VMS.  The fortran created file has a 'fortran carriage
  45. control' record attribute.
  46.