Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Reading an existing file into a fortran code

  1. Dec 24, 2013 #1
    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
  2. jcsd
  3. Dec 24, 2013 #2
    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.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook