file, err := os.Open(inputFile)
if err != nil {
log.Fatal(err)
}
defer file.Close()
scanner := bufio.NewScanner(file)
address := ""

scanner.Scan()
scanner.Scan()
address = scanner.Text()
fmt.Println([]byte(address))


I'm reading string from file, but getting null value inserted as every 
other character in my string. Why is that?
[0 49 0 32 0 97 0 80 0 80 0 73 0 65 0 78 0 32 0 87 0 65 0 89 0 32 0 85 0 78 
0 73 0 84 0 32 0 55 0 49 0 54 0 45 0 49 0 32 0 83 0 79 0 85 0 84 0 72 0 32 
0 83 0 65 0 78 0 32 0 70 0 82 0 65 0 78 0 67 0 73 0 83 0 67 0 79 0 32 0 67 
0 65 0 32 0 57 0 52 0 48 0 56 0 48 0 13 0]

Expected:
[49 32 65 80 80 73 65 78 32 87 65 89 32 85 78 73 84 32 55 49 54 45 49 32 83 
79 85 84 72 32 83 65 78 32 70 82 65 78 67 73 83 67 79 32 67 65 32 57 52 48 
56 48]

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to