Reading an existing file into a fortran code

Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
1 reply · 2K views
angelfaz
Messages
2
Reaction score
0
I am programming in fortran 90/95 and i have a problem opening an existing file for input. I have written the code without any errors, but at compilation time, the file to be read cannot open. It is as if the program does not know the location for the file. I would like to know if there is a specific location in which the file has to be stored in order for the program to recognise and read from it.
I have tried to show the path to the file but it is not working. It is part of my project work and i will very much appreciate any help. Thank you
 
Physics news on Phys.org
I would like to see a few lines of code where you try to open the file.

There may be a couple of things going on.

First, I would start by making sure the input file name does not contain any blank spaces.

Second, I would make sure that both the executable and the input files are in the same directory.

Then, I wouldn't just double click on the executable; instead, I would open a command prompt, change directories to where the executable is and type the name at the prompt.