Reading an existing file into a fortran code

Click For Summary
SUMMARY

The discussion focuses on troubleshooting file input issues in Fortran 90/95. Users encountered problems opening an existing file, with suggestions emphasizing the importance of file path accuracy. Key recommendations include ensuring the input file name has no blank spaces and confirming that both the executable and input files reside in the same directory. Additionally, executing the program from a command prompt rather than double-clicking the executable is advised for better path recognition.

PREREQUISITES
  • Understanding of Fortran 90/95 programming syntax
  • Familiarity with file handling in Fortran
  • Basic command line operations
  • Knowledge of directory structures in operating systems
NEXT STEPS
  • Research Fortran 90/95 file I/O operations
  • Learn about command line navigation and execution
  • Explore debugging techniques for Fortran programs
  • Investigate best practices for file path management in programming
USEFUL FOR

This discussion is beneficial for Fortran developers, students working on programming projects, and anyone troubleshooting file input issues in Fortran applications.

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.
 

Similar threads

  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 25 ·
Replies
25
Views
4K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 5 ·
Replies
5
Views
5K
  • · Replies 12 ·
Replies
12
Views
3K
  • · Replies 3 ·
Replies
3
Views
835
  • · Replies 17 ·
Replies
17
Views
7K
  • · Replies 33 ·
2
Replies
33
Views
3K
Replies
1
Views
7K