ADVERTISEMENT
ADVERTISEMENT

How to make directories using syscall in Golang?

Here, we will learn to make directories using syscall in Golang.
Submitted by IncludeHelp, on November 13, 2021

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.

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

Golang syscall Package Programs »



ADVERTISEMENT




ADVERTISEMENT


Comments and Discussions!

ADVERTISEMENT

ADVERTISEMENT

ADVERTISEMENT

ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.