- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I want to run a fortran code in debug mode in visual studio. the code reads input from stdin (unif 5). I would like it to read from an input file. Can you tell me how to assign my input file to stdin?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is VERY easy to do.
Right click on the project, select Properties > Debugging, In the field "Command Arguments" type:
< inputfilename.txt
By default it will look in the project directory.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can do this by setting environment variables. See the details at https://software.intel.com/en-us/node/510821 .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Do you really want to TEMPORARILY (e.g. for debugging) want to assign a file to unit 5? I.e. not permanently, in which case you would simply open the input file to another unit number?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I tried setting the environment variable FORT5 to my file name (including path). that didn't help the situation in the debugger. when I run the code in visual studio a command prompt window opens and the code expects input there. I don't want to change the code to open the file explicitly. Thanks for your hellp
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is VERY easy to do.
Right click on the project, select Properties > Debugging, In the field "Command Arguments" type:
< inputfilename.txt
By default it will look in the project directory.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Linda S.: Please read the documentation fully. If, as is usual these days, you used UNIT=* rather than UNIT=5 for console input in READ statements, the variable to set is FOR_READ, not FORT5. I tried this in VS 2015, and the redirection of the input worked fine.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you Steve

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page