简体   繁体   中英

how to print consloe output into some .txt file in c

Min Profile Cycles  [215914]
Max Profile Cycles  [934625]
Max Profile         [23]
Max Profile Count   [4]

How to print all these console output into some .txt file in c so that whenever i will call that function it will print in txt file instead of printing in console.

因为您的标签是C,所以可以在附加模式下打开文件fopen(),而不是使用printf(),而是对此文件句柄使用fprintf()(以及fwrite()等)。

一种简单的方法是在您的shell中编写如下内容:

$./a.out > hello.txt

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM