In this tutorial, we will discuss a program to create a directory or folder using a C/C program.
To create a new directory, we will use the mkdir() command. Please note that the given code only works with the Windows compiler.
#include <conio.h> #include <dir.h> #include <process.h> #include <stdio.h> void main(){ int check; char* dirname = "tutorialspoint"; clrscr(); check = mkdir(dirname); //checking if directory is created if (!check) printf("Directory created\n"); else { printf("Unable to create directory\n"); exit(1); } getch(); system("dir/p"); getch(); }
Directory created
The above is the detailed content of Create a directory or folder using a C/C++ program. For more information, please follow other related articles on the PHP Chinese website!