Q:

How to make directories using syscall in Golang?

belongs to collection: Golang syscall Package Programs

0

In the Go programming language, to make directories using syscall – we use the Mkdir() function of the syscall package. The Mkdir() function is used to make directories.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Syntax:

func Mkdir(path string, mode uint32) (err error)

Consider the below example demonstrating how to make directories using syscall in Golang?

package main

import (
	"fmt"
	"syscall"
)

func main() {
	// Creating directories
	err := syscall.Mkdir("/tmp/dir1", 0754)

	// Printing message if there is no error
	if err == nil {
		fmt.Println("success")
	}
}

Output

success

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

How to read the contents of a file using syscall i... >>
<< How to get the number of seconds since the epoch u...