mirror of
https://github.com/golang/go
synced 2024-11-21 15:04:44 -07:00
tutorial: make stdin, stdout, stderr work on Windows.
R=brainman CC=golang-dev https://golang.org/cl/4042042
This commit is contained in:
parent
1b112c2297
commit
166b444a93
@ -538,9 +538,9 @@ We can use the factory to construct some familiar, exported variables of type <c
|
||||
<p>
|
||||
<pre> <!-- progs/file.go /var/ /^.$/ -->
|
||||
24 var (
|
||||
25 Stdin = newFile(0, "/dev/stdin")
|
||||
26 Stdout = newFile(1, "/dev/stdout")
|
||||
27 Stderr = newFile(2, "/dev/stderr")
|
||||
25 Stdin = newFile(syscall.Stdin, "/dev/stdin")
|
||||
26 Stdout = newFile(syscall.Stdout, "/dev/stdout")
|
||||
27 Stderr = newFile(syscall.Stderr, "/dev/stderr")
|
||||
28 )
|
||||
</pre>
|
||||
<p>
|
||||
@ -663,7 +663,7 @@ something from the directory of installed packages.
|
||||
(Also, ''<code>file.go</code>'' must be compiled before we can import the
|
||||
package.)
|
||||
<p>
|
||||
Now we can compile and run the program:
|
||||
Now we can compile and run the program. On Unix, this would be the result:
|
||||
<p>
|
||||
<pre>
|
||||
$ 6g file.go # compile file package
|
||||
|
@ -22,9 +22,9 @@ func newFile(fd int, name string) *File {
|
||||
}
|
||||
|
||||
var (
|
||||
Stdin = newFile(0, "/dev/stdin")
|
||||
Stdout = newFile(1, "/dev/stdout")
|
||||
Stderr = newFile(2, "/dev/stderr")
|
||||
Stdin = newFile(syscall.Stdin, "/dev/stdin")
|
||||
Stdout = newFile(syscall.Stdout, "/dev/stdout")
|
||||
Stderr = newFile(syscall.Stderr, "/dev/stderr")
|
||||
)
|
||||
|
||||
func Open(name string, mode int, perm uint32) (file *File, err os.Error) {
|
||||
|
Loading…
Reference in New Issue
Block a user