[英]How do I get the output of executable without using "write" command?
我有一个编译好的 hello world 代码。 如何在文件中获取可执行文件的输出,而不是在程序运行的终端中打印。 可以在代码中不包含“write”命令的情况下完成吗?
创建的可执行文件是“hello.out”并使用“mpif90 hello.f90 -o hello.out”编译
./hello.out > filename
如果您还想在终端上看到输出,您可以将其通过管道传输到tee
:
./hello.out | tee filename
这会将输出写入文件和终端。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.