[英]How to achieve partial output to cmd window and partial redirection to file for c++ program?
I know how to use pipe operator to redirect whole output of a c++ executable file(generated by my c++ code),but the question is that there are some contents that do not need to redirect to file, but to cmd window. 在我對 c++ 編程的有限經驗中,我想可能有某種重定向方法比重定向 pipe 運算符具有更高的優先級,但我已經嘗試了多種變體,但它們似乎都不起作用。 有任何想法嗎?
將std::cout
用於要重定向到文件的內容,將std::cerr
用於要打印到命令 window 的內容。 使用>
和|
進行正常重定向只影響前者。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.