- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'd like to run the Fortran execution file at any directory. But the problem is that its input file should be existed with the execution file in the same directory. For example,
An execution file (model.exe) and input file (input.dat) are locatedat c:projectsmodelrun est
But a working directory is c: est
So I'd like to command using DOS prompt as follows:
c: estc:projectsmodelrun estmodel.exe input
The model.exe was recognized, but the input.dat wasn't because of its loacation directory...
Do you have any comments or suggestions to solve it? Thanks in advance...
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
WHY does the input file have to be in the same directory as the executable?
Bruce
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Use GETARGS twice, onceto get the full-path name of the executable (first argument, numbered '0'), second to get the input data file name (second argument, numbered '1',). use SPLITPATHQQ on the executable to get the path to the executable. It will probably be safe to use SPLITPATHQQ on the second argument also, just in case the datafile is given with a full path, so that you can obtain the bare data file name with no path, then addthe path to the executable (drive+directory+'')to the input data file name. Then use the resulting full-path name to the data file in your OPEN statement.
![](/skins/images/DC0E2679F7049B943291D1ED082A478E/responsive_peak/images/icon_anonymous_message.png)
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page