Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unable to get past problem in code

Status
Not open for further replies.

maxkunz

Programmer
Aug 27, 2014
1
US
All,

I have been trying to compile a code handed over to me. I am using Visual Studio with the Intel Fortran 10.1.011 compiler. I created the project and included all the necessary files and everything else that was required and was able to get the program to build with no errors. When I go to compile it, the program pops up a console window and seems to be waiting for some input for ever. I have tried many things and nothing seems to be working. I am providing the part of the code where it seems to be having this issue below.

[highlight #FCE94F]c If CODE is being used "Standalone", read from unit 5 redirected input.
c If CODE is being called from AutoTune, the description file name is
c passed in.

if (IsMain) then
lun_description = 5
OPEN( UNIT=lun_description,
1 STATUS='OLD',
1 READONLY,
1 CARRIAGECONTROL='LIST')
else
OPEN( UNIT=lun_description,
1 FILE=DescFileName,
1 STATUS='OLD',
1 READONLY,
1 CARRIAGECONTROL='LIST')
endif

READ(UNIT=lun_description, ERR=915, NML=OPER_INFO)
rewind(lun_description)
[/highlight]

Note that I have checked that in the project properties, I have provided the path to the location where the project file exists. Also, the input file that this program is supposed to read is provided in that folder. I have also provided the name of this file under "command line arguments". It almost seems like this "unit=5" is open somewhere and I am not able to find it nor understand what exactly FORTRAN is looking for. Can any of you gurus out there point me in the right direction?

Thanks

Max
 
Like the note says, I would speculate that you are expected to provide input via unit 5 since you have launched the program directly...as opposed to having been launched via another application.

Unit 5 in Fortran is nothing but the standard input channel and you are expected to use the keyboard to provide input or use re-direction if you do not want to type and already have your input in a file.

I don't use IDEs or projects but maybe you need to do something different about the way to indicate the arguments to the program...using re-direction may have to be specified in a slightly different manner than just a file name as an argument...maybe you can simply insert "<" before the input file name.

Alternately, attempt to run the program from a terminal:
Open a command terminal
change directories to where your input file is
execute your program calling it by full name and use re-direction to provide input, like so:
c:\path\to\executable\myprogram.exe < inputfile

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top