Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
20
Task/Copy-stdin-to-stdout/Go/copy-stdin-to-stdout-1.go
Normal file
20
Task/Copy-stdin-to-stdout/Go/copy-stdin-to-stdout-1.go
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"io"
|
||||
"os"
|
||||
)
|
||||
|
||||
func main() {
|
||||
r := bufio.NewReader(os.Stdin)
|
||||
w := bufio.NewWriter(os.Stdout)
|
||||
for {
|
||||
b, err := r.ReadByte()
|
||||
if err == io.EOF {
|
||||
return
|
||||
}
|
||||
w.WriteByte(b)
|
||||
w.Flush()
|
||||
}
|
||||
}
|
||||
10
Task/Copy-stdin-to-stdout/Go/copy-stdin-to-stdout-2.go
Normal file
10
Task/Copy-stdin-to-stdout/Go/copy-stdin-to-stdout-2.go
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"io"
|
||||
"os"
|
||||
)
|
||||
|
||||
func main() {
|
||||
io.Copy(os.Stdout, os.Stdin)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue