Fortran Reading an existing file into a fortran code

AI Thread Summary
The discussion revolves around troubleshooting an issue with opening an existing file for input in Fortran 90/95. The user is facing a problem where the program cannot locate the file, despite the code compiling without errors. Key suggestions include ensuring that the input file name does not contain blank spaces and confirming that both the executable and the input file are located in the same directory. Additionally, it's recommended to run the executable from a command prompt rather than by double-clicking, as this can help ensure the correct working directory is set.
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
 
Technology 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.
 
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
I have a quick questions. I am going through a book on C programming on my own. Afterwards, I plan to go through something call data structures and algorithms on my own also in C. I also need to learn C++, Matlab and for personal interest Haskell. For the two topic of data structures and algorithms, I understand there are standard ones across all programming languages. After learning it through C, what would be the biggest issue when trying to implement the same data...

Similar threads

Replies
8
Views
1K
Replies
2
Views
1K
Replies
25
Views
3K
Replies
5
Views
5K
Replies
12
Views
3K
Replies
3
Views
677
Replies
17
Views
6K
Replies
33
Views
2K
Replies
5
Views
2K
Back
Top