I am using a third party tool in Go with the help of exec.Command and that program will print out a large integer value which obviously is in string format. I having trouble converting that string to int (or more specifically uint64).
Details: (You can ignore what program it is etc. but after running it will return me a large integer)
cmd := exec.Command(app, arg0, arg1, arg3)
stdout, err := cmd.Output()
if err != nil {
fmt.Println(err.Error())
return
}
temp := string(stdout)
After I ran above, I am trying to parse it as below
myanswer, err = strconv.Atoi(temp) //I know this is not for uint64 but I am first trying for int but I actually need uint64 conversion
if err != nil {
fmt.Println(err)
return
}
Problem here is that the stdout is appending \r\n to its output which AtoI is not able to parse and gives the error
strconv.Atoi: parsing "8101832828\r\n": invalid syntax
Can someone pls help me on how to convert this string output to a uint64 and also int format pls?