Added ReadRune method to file
This commit is contained in:
parent
3ba528509c
commit
47517d7139
27
file/file.go
27
file/file.go
@ -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)
|
||||||