Skip to content

Instantly share code, notes, and snippets.

@Ramko9999
Last active April 25, 2021 01:42
Show Gist options
  • Select an option

  • Save Ramko9999/7d4c4a89e739b03e2115545c6d1fe0f3 to your computer and use it in GitHub Desktop.

Select an option

Save Ramko9999/7d4c4a89e739b03e2115545c6d1fe0f3 to your computer and use it in GitHub Desktop.
import (
"os"
)
func createFile(){
filePtr, err := os.Create("./test/creating.txt");
if err != nil {
log.Fatal(err);
}
defer filePtr.Close(); // close the file
// We can read from and write to the file
}
func openFile(){
filePtr, err := os.Open("./test/creating.txt");
if err != nil {
log.Fatal(err);
}
defer filePtr.Close(); // close the file
// We can read from and write to the file
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment