[Go]Capture user’s entered sentence and save into a file.

This extends the previous post about capturing user's input. The captured input is stored into a file known as text.txt. To write a string to a file ioutil.WriteFile is used, this method requires three arguments: filename in string string byte slice, which is the ascii representation of the string slice The permission, if unsure check … Continue reading [Go]Capture user’s entered sentence and save into a file.

[Go]Get user’s input string

There are several ways to get the input string. The first method is to use bufioNewReader(os.Stdin) to read the stdin, using the reader object get the user input from stdin until a delimiter is input by user, the entire string includes the delimiter enter by user. First method, use bufio to get stdin Second method … Continue reading [Go]Get user’s input string