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!

Very simple input question 1

Status
Not open for further replies.

JennieEnglish

Programmer
Apr 27, 2012
2
US
Hi, all.

I'm definitely not a FORTRAN coder, and don't even know how to phrase this question (hence the vague title!).

I'm writing a code, callbuilds.f that will (among other things) call an executable and give it a file name:

call system('./buildsource < sourcename')

but I don't know how to access 'sourcename' from buildsource.f It's a file that I write in callbuilds.f that simply contains the name of the source file. Any help/advice on how to implement/improve this would be gratefully received! Thank you!!
 
Is this homework?...careful about that, 'cause around this particular forum homework requests are not well looked upon.

Just a short hint.

A system call is basically a request for a command to be executed as if you were typing at the command prompt. In your case, the command is

buildsource < sourcename

The '<' character performs what is called re-direction...in other words, it makes the contents of the file 'sourcename' look like it is coming through standard input as far as 'buildsource' is concern.

To read such input from within 'buildsource', you do not open any file, instead, you use the default unit number for standard input...or simply '*', as in READ(*,*)

Hope this helps.
 
Haha! No this isn't a homework assignment. I am at university, but I'm working on research for an MS... I just know nothing about FORTRAN. This makes perfect sense, though. Thank you so much!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top