Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29274 Discussions

Accessing data file in other project or workspace

moholsu
Beginner
555 Views
I have Compaq Visual FORTRAN standard edition, v6.6B. My research focuses on the development of the physics and mathematical aspects of number crunching codes and I get easily confused by the complexity of this FORTRAN software.

I want to allow .exe files in various projects access to a .bin (or .txt) data file located in a different project (or even a different workspace) without having to move the data file around using Windows explorer.

For example, a .bin file of data is produced by an .exe in, say, project A. I want an .exe in project B to read the .bin data from project A, perform some calculations on it, and over-write the .bin data while the file remains in project A. Then, a graphics .exe in project C or Workspace Graphit will read in this new .bin data and plot a graph.

I use the executables 'read (7)' and 'write (7)' in the source codes, where unit 7 is OPENed as format='bin'.

Thanks for any help.
0 Kudos
2 Replies
Steven_L_Intel1
Employee
555 Views
You will have to modify your program to open the file from the appropriate location - use the FILE= keyword in the OPEN statement. Data files do not have any special connection to projects - you can add a data file to a project, but all that does is let you easily view or edit it. Your application doesn't know that the file is in a project.

The default when run from Developer Studio is that files are looked for in the project directory, since that is the default Developer Studio sets. When run from outside Developer Studio, the default is typically the same folder as the EXE is in.

Steve
0 Kudos
isn-removed200637
555 Views
You should program your application to use GETARG to obtain command-line arguments. You can then supply the data-file name on the command line that executes an .EXE.
(you will have to supply the full path as well as the file name, UNLESS you start the .EXE from a shortcut to it by dragging an dropping a filename onto the short-cut icon, in which case Windows supplies the full path with the filename and the whole name turns up as an argument after the .EXE name as if the .EXE was started from the command line.). HTH
0 Kudos
Reply