Help with Fortran 77 - File Opening Questions

  • Context: Fortran 
  • Thread starter Thread starter Bruno Solheid
  • Start date Start date
  • Tags Tags
    Fortran
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
1 reply · 5K views
Bruno Solheid
Messages
1
Reaction score
0
Hi, I have some doubts about how to open files in fortran 77.
The file must to be inside some particular directory?
Sorry about my english.
 
Physics news on Phys.org
If you are using Windows, try the following code. If you are using Unix or Linux, change the back-slash to slash, and use the appropriate directory name, for example:
/usr/myname/f77/test.dat
The status could be 'new', 'old', 'unknown', and there are other options.

Code:
C      open(10, file='testopen.dat',status='unknown')
C      open(10, file='..\testopen.dat',status='unknown')
       open(10, file='c:\proj\f77\testopen.dat',status='unknown')
C      read(10,*)x
C      read(10,*)y
C      print *,x,y
C      rewind 10
      write(10,*)10.0
      write(10,*)12.0
      print *,10.0,12.0
      stop
      end