duanke6249
2016-08-04 16:54
浏览 454
已采纳

Golang如何实现stdin / stdout / stderr

I did a little program which was able to parse input from command line. It worked well by means of std.in. However, when I looked up the official document for further learning, I found there was too much stuff for me.

var (
   Stdin = NewFile(uintptr(syscall.Stdin), "/dev/stdin")
)

I read the document of func NewFile, type uintpty, Package syscall individually but could not figure out the whole. Also, I did not know the meaning of /dev/stdin, either.

I never learned another static programming language except for go. How could I realize the magic of stdin?

图片转代码服务由CSDN问答提供 功能建议

我做了一个小程序,可以解析命令行中的输入。 通过 std.in </ code>可以很好地工作。 但是,当我查阅正式文档进行进一步学习时,发现对我来说太多了。</ p>

  var(
 Stdin = NewFile(uintptr(syscall.Stdin  ),“ / dev / stdin”)
)
 </ code> </ pre> 
 
 

我阅读了 func NewFile </ code>, type uintpty < / code>,打包系统调用</ code>,但无法弄清整个问题。 另外,我也不知道 / dev / stdin </ code>的含义。</ p>

除了 go </ code>,我从没学过另一种静态编程语言 >。 我怎么能意识到 stdin </ code>的魔力?</ p> </ div>

1条回答 默认 最新

相关推荐 更多相似问题