使用 a.out file_name_here
运行已编译的 C 程序有什么区别?和a.out < file_name_here
?
我记得一些有关 Linux 管道的信息,但我不记得如何制作 a.out
file 使用 <
接受文件符号。
基本上我要问的是:C 代码如何查找符合以下条件的 C 程序:
- file_name_here 是一个文本文件,内容为“hello world”
- 终端在命令行中获取“a.out < file_name_here”
- 终端显示输出:“hello world”
最佳答案
a.out file_name_here
传递“file_name_here”作为参数。
a.out < file_name_here
由 shell 处理,并将“file_name_here”的内容呈现给程序的“stdin”。
关于c - 如何在 Linux 上将文件读入 C 程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31375337/