이 튜토리얼에서는 C/C++ 프로그램을 사용하여 디렉토리 또는 폴더를 생성하는 프로그램에 대해 설명합니다.
새 디렉토리를 생성하려면 mkdir() 명령을 사용합니다. 주어진 코드는 Windows 컴파일러에서만 작동합니다.
예시
#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