Trong hướng dẫn này, tạo thư mục với chương trình C/C++.
Dùng lệnh mkdir(). Lưu ý: code chỉ chạy trên trình biên dịch Windows.
Ví dụ
#include#include #include #include void main(){ int check; char* dirname = "tutorialspoint"; clrscr(); check = mkdir(dirname); // kiểm tra thư mục tạo thành công if (!check) printf("Directory created\n"); else { printf("Unable to create directory\n"); exit(1); } getch(); system("dir/p"); getch(); }
Kết quả
Directory created