views:

64

answers:

2

It just occur to me that following command can print output in text file.

./a.out < infile.txt > actualoutput.txt

But i still wondering what < infile.txt > is for?

And what other arguments i can give when executing this object file?

+3  A: 

this is the file that will be used as the standard input ( aka stdin ). Your command is the same as

cat infile.txt | a.out > output.txt
Pierre
What is meant by standard input (aka stdin)?
itsaboutcode
see http://en.wikipedia.org/wiki/Standard_streams#Standard_input_.28stdin.29
Pierre
do you mean it started to get input from infile.txt instead of keyboard?
itsaboutcode
http://www.partmaps.org/era/unix/award.html
sigjuice
Thanks man, it was really helpful.
itsaboutcode
... for some meaning of "same as" which I don't share. :)
Randal Schwartz
+1  A: 

The < infile.txt means take standard input from infile.txt.

Similarly > actualoutput.txt means to send standard output to actualoutput.txt.

For more information on redirection take a look here.

Rod Hyde
Thanks it help alot.
itsaboutcode