Read a string from stdin
This commit is contained in:
parent
fdb34d8533
commit
0d5f2d0fcc
@ -17,6 +17,17 @@ func ReadKey() (rune, int) {
|
|||||||
return ch, size
|
return ch, size
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func Read() (string, int) {
|
||||||
|
var buff []byte
|
||||||
|
|
||||||
|
size, err := reader.Read(buff)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return string(buff), size
|
||||||
|
}
|
||||||
|
|
||||||
// Print string to stdout
|
// Print string to stdout
|
||||||
func Write(s string) {
|
func Write(s string) {
|
||||||
fmt.Print(s)
|
fmt.Print(s)
|
||||||
|
Loading…
Reference in New Issue
Block a user