Topic: I/O Help: Understanding how to set up data Files
I would like to have my Fortran program open and read data files, then write back to files at the end of the program. I have written a simple program to open and read a data file that is in the same top level directory as the build and modules folders. I have no idea how to create a data file. I tried to use notepad to create a vertical list of numbers (each number on a new line) with no commas or punctuation. I called the file read1.DAT, changing the .txt extension to a .DAT
I have written the program to open the file and return a value for IOSTAT. If the file opens, IOSTAT=0 and the reading process is supposed to begin.
The first time I did this, I tried to open the read1.DAT file. . This was not successful, returning the error message "an error occurred reading line 1" which indicated that the file was opened but could not be read.
I then created an identical file and called it read1.txt. This time I received a message saying that there was an error opening the file, IOSTAT=2 (I don't know what this signifies except that the file was not opened properly).
Please help me understand how to set up files that contain data that can be read by my Simply Fortran code. I'm not sure if the files have to be labeled ".DAT" or if there are any rules on how to set them up so the program can read them. Any help would be gratefully received.
Regards
Euan