Golang bufio.ScanBytes() function example
package bufio
ScanBytes is a split function for a Scanner that returns each byte as a token.
bufio.ScanBytes() function usage example
file, err := os.Open("for")
if err != nil {
panic(err.Error())
}
defer file.Close()
reader := bufio.NewReader(file)
scanner := bufio.NewScanner(reader)
scanner.Split(bufio.ScanBytes)
for scanner.Scan() {
fmt.Println(scanner.Bytes())
}
Advertisement
Something interesting
Tutorials
+9k Golang : Inject/embed Javascript before sending out to browser example
+6.8k Swift : substringWithRange() function example
+19.6k Golang : Set or Add HTTP Request Headers
+14.3k Golang : How to shuffle elements in array or slice?
+11.5k Use systeminfo to find out installed Windows Hotfix(s) or updates
+8.7k Golang : Combine slices but preserve order example
+6.1k Java : Human readable password generator
+6.1k Golang : Missing Subversion command
+20.8k Golang : Convert date string to variants of time.Time type examples
+18k Golang : Check if a directory exist or not
+80.6k Golang : How to return HTTP status code?