我想閱讀stdinGo程序的原始內(nèi)容。例如,如果我這樣做了echo test stdin | go run test.go,我希望可以訪問(wèn)“ test stdin”。我嘗試從中讀取os.Stdin,但是如果其中沒(méi)有任何內(nèi)容,則它將等待輸入。我也嘗試過(guò)先檢查大小,但是os.Stdin.Stat().Size()即使傳入輸入也為0。
- 3 回答
- 0 關(guān)注
- 232 瀏覽
添加回答
舉報(bào)
0/150
提交
取消