Q:

How to make directories using syscall in Golang?

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)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now