home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / fortran / 3273 < prev    next >
Encoding:
Text File  |  1992-08-29  |  1.3 KB  |  35 lines

  1. Newsgroups: comp.lang.fortran
  2. Path: sparky!uunet!cs.utexas.edu!hermes.chpc.utexas.edu!aswx266
  3. From: aswx266@chpc.utexas.edu (Michael Lemke)
  4. Subject: Re: copying files in FORTRAN on using Sun Fortran
  5. Message-ID: <1992Aug29.062208.26841@chpc.utexas.edu>
  6. Organization: The University of Texas System - CHPC
  7. References: <1992Aug28.195415.27820@ctr.columbia.edu>
  8. Date: Sat, 29 Aug 92 06:22:08 GMT
  9. Lines: 24
  10.  
  11. In article <1992Aug28.195415.27820@ctr.columbia.edu> anselmo@cumesb.mech.columbia.edu (Andrew P. Anselmo) writes:
  12. >
  13. >Sorry to intrude on the scientists can/cannot program  issue, but a small
  14. >technical problem...
  15. >
  16. >How easy is it to submit unix commands while in a Fortran program?
  17. >
  18. >I basically need to copy a file (without knowing the format or what's
  19. >inside) to another; I've RTFM, but I can't seem to track it down.
  20.  
  21. Although I don't know where you can find it (presumably man 3F intro 
  22. should get you started) it is easy as pie:
  23.  
  24.     call system( 'cp file1 file2' )
  25.  
  26. If you want to feed the command's output back to a Fortran variable 
  27. (something similar as set a=`date`) it gets tricky.  You would need 
  28. popen for this but I don't know if that is equally easy to access as
  29. system.  See the man page as I mentioned above.
  30.  
  31. -- 
  32. Michael Lemke
  33. Astronomy, UT Austin, Texas
  34. (michael@io.as.utexas.edu or UTSPAN::UTADNX::IO::MICHAEL [SPAN])
  35.