console/read_console_input

Code

read_console_input.odin ¶
16 linesSource

1package read_console_input
2
3import "core:fmt"
4import "core:os"
5
6main :: proc() {
7	buf: [256]byte
8	fmt.println("Please enter some text:")
9	n, err := os.read(os.stdin, buf[:])
10	if err != nil {
11		fmt.eprintln("Error reading: ", err)
12		return
13	}
14	str := string(buf[:n])
15	fmt.println("Outputted text:", str)
16}

Declarations Used 4