Added ReadRune method to file

This commit is contained in:
Sasha Koshka 2022-08-09 01:07:14 -04:00
parent 3ba528509c
commit 47517d7139

View File

@ -13,14 +13,14 @@ type File struct {
reader *bufio.Reader reader *bufio.Reader
currentLine int currentLine int
currentColumn int currentColumn int
lines [][]byte lines []string
} }
// Open opens the file specified by path and returns a new File struct. // Open opens the file specified by path and returns a new File struct.
func Open (path string) (file *File, err error) { func Open (path string) (file *File, err error) {
file = &File { file = &File {
path: path, path: path,
lines: [][]byte { []byte { } }, lines: []string { "" },
} }
file.file, err = os.OpenFile(path, os.O_RDONLY, 0660) file.file, err = os.OpenFile(path, os.O_RDONLY, 0660)