http://stackoverflow.com/questions/5884154/golang-read-text-file-into-string-array-and-write 方法一 package main import ( "bufio" "fmt" "log" "os" ) // readLines reads a whole file into memory // and returns a slice of
在类Unix操作系统里面,.dup2和dup都通过系统调用来产生一份file descriptor 的拷贝. dup对我来说还很简单 int dup(int filedes); dup2就有点犯迷糊了 int dup2(int filedes1,int filedes2); 其实这样declaration更好 int dup2(int oldfd,int newfd) 下面是apue给出的解释 With dup2, we specify the value of