I have the following code:
buffer := make([]byte, 256)
conn.Read(buffer)
result:= string(buffer)
fmt.Println("Val:", result)
floatResult, _ := strconv.ParseFloat(result, 64)
fmt.Println("Val on float:", floatResult)
The output is the following:
Val: 40.385167
Val on float: 0
This seems the correct way to parse string into float64's, is there something i'm missing?
You can create new slice with
lenequals read bytes (look at Reader)PLAYGROUND (io.Reader stub)