You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
331 B
25 lines
331 B
4 years ago
|
package main
|
||
|
|
||
|
import (
|
||
|
"bufio"
|
||
|
"log"
|
||
|
"os"
|
||
|
)
|
||
|
|
||
|
func fileOpen(fname string) {
|
||
|
f, err := os.Open(fname)
|
||
|
if err != nil {
|
||
|
log.Fatal(err)
|
||
|
}
|
||
|
defer f.Close()
|
||
|
|
||
|
fread := bufio.NewScanner(f)
|
||
|
fread.Split(bufio.ScanLines)
|
||
|
state.rows = nil
|
||
|
|
||
|
for fread.Scan() {
|
||
|
state.rows = append(state.rows, fread.Text())
|
||
|
}
|
||
|
state.file = fname
|
||
|
}
|