1
0
Fork 0

Read a string from stdin

This commit is contained in:
Timothy Warren 2021-03-25 13:20:33 -04:00
parent fdb34d8533
commit 0d5f2d0fcc
1 changed files with 11 additions and 0 deletions

View File

@ -17,6 +17,17 @@ func ReadKey() (rune, int) {
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
func Write(s string) {
fmt.Print(s)