first commit

This commit is contained in:
RussellChamp committed 2021-11-30 16:01:35 -05:00
1 parent 4c88777d7a
commit 1208efd0af
8 files changed
+342

No files matched your search

+36
View File
@@ -0,0 +1,36 @@
package main
import (
"bufio"
"fmt"
"os"
)
func tryMe(e error) {
if e != nil {
fmt.Println("OH SNAP!")
panic(e)
}
}
func files() {
dat, err := os.ReadFile("./data.txt")
tryMe(err)
fmt.Print(string(dat))
fmt.Println("\n---")
f, err := os.Open("./data.txt")
tryMe(err)
coupleBytes := make([]byte, 10)
num, err := f.Read(coupleBytes)
tryMe(err)
fmt.Println(num, string(coupleBytes))
reader := bufio.NewReader(f)
rBuf, err := reader.Peek(5)
tryMe(err)
fmt.Println("buff reader", string(rBuf))
f.Close()
}