I need to read a file of integers into an array. I have it working with this:
package main
import (
\"fmt\"
\"io\"
\"os\"
)
func readFile(filePath
Your solution with fmt.Fscanf is fine. There are certainly a number of other ways to do though, depending on your situation. Mostafa's technique is one I use a lot (although I might allocate the result all at once with make. oops! scratch that. He did.) but for ultimate control you should learn bufio.ReadLine. See go readline -> string for some example code.