Google Search

Saturday, October 24, 2015

C program to create a directory/folder

‪#‎include‬<stdio.h>
#include<conio.h>
#include<process.h>
#include<dir.h>
void main() {
int check;
char *dirname;
clrscr();
printf("Enter a directory path and name to be created (C:/name):");
gets(dirname);
check = mkdir(dirname);
if (!check)
printf("Directory created\n");
else
{
printf("Unable to create directory\n");
exit(1); }
getch();
system("dir/p");
getch();
}

No comments:

Post a Comment