Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
166b444a
Commit
166b444a
authored
Jan 18, 2011
by
Rob Pike
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tutorial: make stdin, stdout, stderr work on Windows.
R=brainman CC=golang-dev
https://golang.org/cl/4042042
parent
1b112c22
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
7 deletions
+7
-7
doc/go_tutorial.html
doc/go_tutorial.html
+4
-4
doc/progs/file.go
doc/progs/file.go
+3
-3
No files found.
doc/go_tutorial.html
View file @
166b444a
...
...
@@ -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
...
...
doc/progs/file.go
View file @
166b444a
...
...
@@ -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
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment