Golang Program to Create Empty Text (TXT) File in Local File System

Golang Program to Create Empty Text (TXT) File in Local File System The article is a lively article because it contains interesting information and your favorite.   

Go language also allows you to create files. For creating a file it provides Create() function, this function is used to create or truncate the given named file.

Golang Program to Create Empty Text (TXT) File in Local File System

Golang Program to Create Empty Text (TXT) File in Local File System

app.go

package main
 
import (
	"log"
	"os"
)
 
func main() {
	emptyFile, err := os.Create("empty.txt")
	if err != nil {
		log.Fatal(err)
	}
	log.Println(emptyFile)
	emptyFile.Close()
}

Read Also: C# Program to Demonstrate Tower of Hanoi

Conclusion

I hope you find the article Golang Program to Create Empty Text (TXT) File in Local File System uses. The reason is that we have told you all the information through this article in a way that you can understand. And if you have any doubts, you can express your doubts through the comment box. We also ask that you help share this article with your friends.

Hi, I'm Ranjith a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Deekshi. Here, I post about programming to help developers.

Share on:

Leave a Comment