INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Unable to get past problem in code

Unable to get past problem in code

(OP)
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.

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)


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

RE: Unable to get past problem in code

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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close