Golang fmt.Fscanf () returns a value of 0 when it encounters a line break

ask for advice:
there is a file test.in
that contains
6 5
3 4
to read, but after reading 65, it will read a 0 and then read 3
code as follows

file, err := os.Open("test.in")
if err != nil {
    panic(err)
}
var one, two,third,four int

fmt.Fscanf(file, "%d", &one) //one 6
fmt.Fscanf(file, "%d", &two) //two 5
fmt.Fscanf(file, "%d", &third) // third 0
fmt.Fscanf(file, "%d", &four )  //four 3

how to avoid reading 0
Thank you

Mar.28,2021

Scan, Fscan, Sscan treat newlines in the input as spaces.

fmt

this is how he works. Now that he understands the principle, if you want to continue to use this method, you can format it first, replace the line break with a space, and then give it to Fscanf

.

change it to:
fmt.Fscan (file, & one) / / one 6
fmt.Fscan (file, & two) / / two 5
fmt.Fscan (file, & third) / / third 3
fmt.Fscan (file, & four) / / four 4

Fscanf scans the text from r and saves the white space-delimited values that were successfully read into the parameters successfully passed to this function according to the format specified by the format parameter. Returns the number of entries successfully scanned and any errors encountered.
Fscan scans the text from r and saves the white space-delimited values that were successfully read into the parameters that were successfully passed to this function. Line breaks are considered blank. Returns the number of entries successfully scanned and any errors encountered. If fewer entries are read than the parameters provided, an error report is returned.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eb4fed-2522.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eb4fed-2522.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?