Origin of <file.tmp to pass input parameters

In summary, the use of input redirection in the command line allows for automatic passing of file names in programs that ask for input, and this concept works in both Unix and Windows systems.
  • #1
jelanier
67
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
 
Technology news on Phys.org
  • #2
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.
 

Related to Origin of <file.tmp to pass input parameters

What is the purpose of using a file.tmp to pass input parameters?

The use of a file.tmp to pass input parameters allows for a more organized and efficient way of storing and passing data to a program or script. It helps to avoid clutter and confusion by separating the input data from the actual code.

How does a file.tmp store input parameters?

A file.tmp stores input parameters by creating a temporary file that contains the data in a specific format. This format can be read and interpreted by the program or script to access the input parameters and use them in the desired way.

Why is a file.tmp preferred over passing input parameters directly?

Passing input parameters directly can lead to errors and make it difficult to manage and update the code. Using a file.tmp ensures that the input parameters remain unchanged and can be easily accessed and modified if needed.

Can a file.tmp be used for multiple input parameters?

Yes, a file.tmp can store multiple input parameters by using a specific format to separate and organize the data. This allows for a more flexible and scalable way of passing input parameters to a program or script.

Are there any security concerns with using a file.tmp for input parameters?

It is generally safe to use a file.tmp for input parameters as long as proper precautions are taken, such as setting appropriate permissions for the file and avoiding sensitive information. However, it is always important to be cautious when handling any type of data, including input parameters.

Similar threads

  • Programming and Computer Science
Replies
5
Views
1K
  • Programming and Computer Science
Replies
2
Views
1K
  • Programming and Computer Science
Replies
6
Views
1K
  • Programming and Computer Science
Replies
2
Views
3K
  • Programming and Computer Science
Replies
3
Views
922
  • Programming and Computer Science
3
Replies
89
Views
4K
  • Programming and Computer Science
Replies
4
Views
503
  • Programming and Computer Science
Replies
17
Views
2K
  • Programming and Computer Science
Replies
16
Views
8K
  • Programming and Computer Science
Replies
5
Views
1K
Back
Top