×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

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.

Students Click Here

Allowing for an input file

Allowing for an input file

Allowing for an input file

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

RE: Allowing for an input file

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.

RE: Allowing for an input file

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

RE: Allowing for an input file

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 smile

Here I found
https://stackoverflow.com/questions/11447598/redir...
that this is how it should be used in Powershell

CODE

Get-Content filein.lst | ./extracks > fileout.trk 


RE: Allowing for an input file

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

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! Already a Member? Login


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