![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Create Directory or Folder with C/C++ Program
In this tutorial, we will be discussing a program to create directory or folder with C/C++ program.
To create a new directory we will be using the mkdir() command. Note that the given code will work only for windows compiler.
Example
#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(); }
Output
Directory created
Advertisements