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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Allowing for an input file 1

Status
Not open for further replies.

garynewport2

Instructor
Jun 16, 2011
9
GB
I have a Fortran program that allows an input file to be defined on execution, as well as an output file...

Code:
.extracks <filein.lst >fileout.trk

I am running this on my Mac and on a Windows system.

The output part (>) works fine but I cannot use the input declaration (<).

How do I do this on the commandline to achieve the required result?
 
You say, your program allows an input file to be defined on execution but you cannot use input redirection with "<".
What happens when you try to use only "<" like this ?
Code:
extracks < filein.lst

It could have several reasons:
- Maybe your program tries to read a file with a specific name and you can then use only output redirection
- Or your input file is not in a format as the program expected: For example it expect two integer numbers M and N in the first line and then it expects another M rows with N columns each of floating point numbers

The reason why it doesn't work is not apparent without seeing the program source file.
 
It turns out that my choice of command line operations (PowerShell) is the cause; it reserves < for potential future usage.

If I had stuck to the good old command prompt, I would never have encountered the issue.

It also transpires that I probably don’t need to use the program anyway. It creates chart data that I can use to generate a Herschel-Russell Diagram; but I can just as easily use IDL to create the graph from the raw data I get from my Fortran simulation program that IS working! Hahaha!

Thank you for your help. :)
 
You wrote, that you are running this on the Mac and on a Windows system, so I thought that the issue with the redirection is on the both systems.
But thanks for the sharing your experience with power shell redirection. Until now I have never used Powershell instead of the windows default command prompt. I only used it to run a self-written Powershell scripts. But it wouldn't even occur to me in a dream that the redirection operators, that are common in all shells, would not work as expected in PowerShell :)

Here I found
that this is how it should be used in Powershell
Code:
Get-Content filein.lst | ./extracks > fileout.trk
 
Yes, sorry. I have tried running it on both systems. This particular issue arose on my Windows system, and I incorrectly connected the failed attempt on both as the same cause - evidence of a failing memory.
The Mac issue was not a failure of code but of what I got out the other side of the program!
Shows I’m working too hard! Hahaha.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top