簡體   English   中英

將C程序的輸出重定向為Linux命令Shell中另一個程序的輸入

[英]Redirecting output of a C program as input of another program in Linux command shell

我編寫了一個程序p1.c ,該程序從linux命令外殼中獲取輸入( Using- char n=argv[1] )。 我希望將p1.c的字符輸出作為程序p2.c輸入。 我怎樣才能做到這一點? 我使用了命令./p2.out < ./p1.out T > output.txt 由於將'T'用作p2.out輸入並將其輸出寫入output.txt因此它似乎不起作用。

使用管道./p1.out T | ./p2.out ./p1.out T | ./p2.out

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM