Answers for "golang file read write example"

Go
0

golang writefile example

err := os.WriteFile("index.txt", []byte("example writefile using go"), os.ModePerm)
if err != nil {
  fmt.Println(err)
}

res, _ := os.ReadFile("index.txt")
fmt.Println(string(res))
Posted by: Guest on October-04-2021

Browse Popular Code Answers by Language