Origin of <file.tmp to pass input parameters

Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
1 reply · 2K views
jelanier
Messages
67
Reaction score
1
I was just curious. I have a program that asks for input file name and output name when the console is executed. I needed to run it and automatically pass these file names. I found a way..

test.exe <files.tmp

where files.tmp has 2 lines. First line is name of input file, second is output file.

It works, and the exe runs without asking for file names. I tried it on several of my FORTRAN console exes and it works! It will pass whatever the exe asks for input.

Where does this come from? I was thinking unix, but it works in windows.
Any ideas?

Jim
 
Physics news on Phys.org
jelanier said:
I was just curious. I have a program that asks for input file name and output name when the console is executed. I needed to run it and automatically pass these file names. I found a way..

test.exe <files.tmp

where files.tmp has 2 lines. First line is name of input file, second is output file.

It works, and the exe runs without asking for file names. I tried it on several of my FORTRAN console exes and it works! It will pass whatever the exe asks for input.

Where does this come from? I was thinking unix, but it works in windows.
Any ideas?

Jim

It works because the concept of input redirection works in both Unix (or Linux) and Windows. The < character on the command line means "take input from this file instead of the console (keyboard)."

Similarly, the > character redirects output from the usual output device (the monitor) to whatever file appears following this character.