Commit 166b444a authored by Rob Pike's avatar Rob Pike

tutorial: make stdin, stdout, stderr work on Windows.

R=brainman
CC=golang-dev
https://golang.org/cl/4042042
parent 1b112c22
...@@ -538,9 +538,9 @@ We can use the factory to construct some familiar, exported variables of type <c ...@@ -538,9 +538,9 @@ We can use the factory to construct some familiar, exported variables of type <c
<p> <p>
<pre> <!-- progs/file.go /var/ /^.$/ --> <pre> <!-- progs/file.go /var/ /^.$/ -->
24 var ( 24 var (
25 Stdin = newFile(0, &quot;/dev/stdin&quot;) 25 Stdin = newFile(syscall.Stdin, &quot;/dev/stdin&quot;)
26 Stdout = newFile(1, &quot;/dev/stdout&quot;) 26 Stdout = newFile(syscall.Stdout, &quot;/dev/stdout&quot;)
27 Stderr = newFile(2, &quot;/dev/stderr&quot;) 27 Stderr = newFile(syscall.Stderr, &quot;/dev/stderr&quot;)
28 ) 28 )
</pre> </pre>
<p> <p>
...@@ -663,7 +663,7 @@ something from the directory of installed packages. ...@@ -663,7 +663,7 @@ something from the directory of installed packages.
(Also, ''<code>file.go</code>'' must be compiled before we can import the (Also, ''<code>file.go</code>'' must be compiled before we can import the
package.) package.)
<p> <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> <p>
<pre> <pre>
$ 6g file.go # compile file package $ 6g file.go # compile file package
......
...@@ -22,9 +22,9 @@ func newFile(fd int, name string) *File { ...@@ -22,9 +22,9 @@ func newFile(fd int, name string) *File {
} }
var ( var (
Stdin = newFile(0, "/dev/stdin") Stdin = newFile(syscall.Stdin, "/dev/stdin")
Stdout = newFile(1, "/dev/stdout") Stdout = newFile(syscall.Stdout, "/dev/stdout")
Stderr = newFile(2, "/dev/stderr") Stderr = newFile(syscall.Stderr, "/dev/stderr")
) )
func Open(name string, mode int, perm uint32) (file *File, err os.Error) { func Open(name string, mode int, perm uint32) (file *File, err os.Error) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment