×

Golang Tutorial

Golang Reference

Golang Programs

Golang Practice

Golang Miscellaneous

Golang File Handling Programs

In Go programming language, there is a huge inbuilt library to perform file handling operations (such as writing to a file, reading from a file, renaming, moving, deleting, etc.). Reading and writing files are the basic operations needed for the Go programs and by using these inbuilt libraries, we can easily perform the file handling operations.

This section contains the solved Golang file handling programs. Practice these Golang file handling programs to learn the file handling concept, these programs contain the solved code, outputs, and the detailed explanation of the statements, functions used in the Golang file handling programs.

List of Golang File Handling Programs

  1. Golang program to create a text file
  2. Golang program to write and read data from a text file
  3. Golang program to create an empty file
  4. Golang program to get the size of an existing file in bytes
  5. Golang program to print the permissions of the existing file
  6. Golang program to print the last modified time of an existing file
  7. Golang program to check the specified file is a directory or not
  8. Golang program to rename a specified file with a new name
  9. Golang program to delete a specified file
  10. Golang program to open a file in read-only mode
  11. Golang program to open a file in append mode
  12. Golang program to check a specified file is exists or not
  13. Golang program to set file permission
  14. Golang program to change the ownership of the file in the Linux operating system
  15. Golang program to truncate the data of the file
  16. Golang program to create a copy of the existing file
  17. Golang program to commit or sync data into memory disk
  18. Golang program to write data bytes into a file
  19. Golang program to read bytes from the file
  20. Golang program to demonstrate the Seek() function to random access from the file
  21. Golang program to write data into a file in a single line
  22. Golang program to read data from the file in a single line
  23. Golang program to get the size of the file using Seek() function
  24. Golang program to read data line by line from file using scanner
  25. Golang program to read data from file word by word using the scanner
  26. Golang program to create an empty zip file
  27. Golang program to create a zip file containing a text file
  28. Golang program to create a temp directory in the '/tmp' directory
  29. Golang program to create a temp directory at the specified path
  30. Golang program to create a temp file in the specified temp directory
  31. Golang program to write a structure of binary data into the file
  32. Golang program to read a structure from the file
  33. Golang program to create a specified directory with specified permission
  34. Golang program to create multiple directories with specified permission
  35. Golang program to delete an empty directory
  36. Golang program to list the content of the specified directory
  37. Golang program to read the content of a specified directory and check directories and files



Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.