我可能想得太多了,但是在 GoLang 中,是fmt.Print()寫入標(biāo)準(zhǔn)輸出還是我必須使用os.Stdout.Write?
3 回答

墨色風(fēng)雨
TA貢獻(xiàn)1853條經(jīng)驗(yàn) 獲得超6個贊
是的,它確實(shí)。從源代碼:
// Print formats using the default formats for its operands and writes to standard output.
// Spaces are added between operands when neither is a string.
// It returns the number of bytes written and any write error encountered.
func Print(a ...interface{}) (n int, err error) {
return Fprint(os.Stdout, a...)
}
os.Stdout 確實(shí)代表標(biāo)準(zhǔn)輸出流。
- 3 回答
- 0 關(guān)注
- 270 瀏覽
添加回答
舉報(bào)
0/150
提交
取消