h***o 发帖数: 5030 | 1 Windows下面输出转向是>>,怎么输入转向啊
我写了一个程序a.exe
我希望能够像unix下一样可以写a.exe<>output.txt
可是直接这么写不成,提示"<< was unexpected at this time" |
t****t 发帖数: 6806 | 2 even unix do not use <<
you probably meant
a.exe < input.txt > output.txt
(or >> output.txt, depending on whether you want to append or overwrite) |
P********e 发帖数: 2610 | 3 可以这样
a.exe input.txt >> output.txt
【在 h***o 的大作中提到】 : Windows下面输出转向是>>,怎么输入转向啊 : 我写了一个程序a.exe : 我希望能够像unix下一样可以写a.exe<>output.txt : 可是直接这么写不成,提示"<< was unexpected at this time"
|
h***o 发帖数: 5030 | 4 多谢
【在 t****t 的大作中提到】 : even unix do not use << : you probably meant : a.exe < input.txt > output.txt : (or >> output.txt, depending on whether you want to append or overwrite)
|
k**f 发帖数: 372 | 5
This does not redirect standard input from file input.txt. It takes input.
txt as a command line argument. If the program do not make use of command
line arguments, your suggestion does not work.
>> in redirection means that if the file exists, append the output to the
file; while > means overwrite if the file exists.
【在 P********e 的大作中提到】 : 可以这样 : a.exe input.txt >> output.txt
|