Giving 5 Arguments but getting just 3 in terminal

前端 未结 2 884
情书的邮戳
情书的邮戳 2021-01-29 08:50

I want to pass a file into a c program.

If I am doing it in the IDE this arguments

./test string string < test.txt

return arg

2条回答
  •  梦毁少年i
    2021-01-29 09:21

    The < symbol will insert information from somewhere (a text file) as if you typed it yourself. It's often used with commands that are designed to get information from standard input only.

    For example (using tr):

    tr '[A-Z]' '[a-z]' < fileName.txt > fileNameNew.txt
    

    The example above would insert the contents of fileName.txt into the input of tr and output the results to fileNameNew.txt.

    Answer adapted from this page. For similar information about all symbols, use this page

提交回复
热议问题