gfortran and OS X 10.5.6
By cej38 at Tue, Jan 20 2009 9:42pm |
Ever since I updated to OS X 10.5.6 I have had some problems with my Macbook. One of the problems that I have noticed recently is that gFortran will not compile code that will run correctly. When running a rather simple program, the program will over-write the data in a file that it was supposed to be reading in. And it overwrites it upon getting to the command
open(unit=6,file=xyzfile,status='old')
Has anyone else had this problem?
ifort still works just fine.




gfortran & osx 10.5.6
While there may or may not be a bug here, it used to be in the 'old' days that unit numbers 5,6,and 7 were best to be left alone when doing fortran i/o. If you are using std out on the command line, this will definitely confuse the program as to where std out should go. (that includes just using a print * statement). If not, are you sure you are closing the files after you are done?
FYI, 5 is std in, 6 std out, and 7 std error. You might try changing the specs for the unit numbers. I never use a unit number in the single digits, just got in the habit 20 years ago.
Also, you can in fortran90 make the input file read only, I believe with an extra argument.
hope this is helpful, best of luck.
Lou