Unix编程: 创建多级目录
目标: 创建文件dir/subdir/subdir2/subdir3/file.txt
实现:
mkdir("dir", 0777); mkdir("dir/subdir", 0777); mkdir("dir/subdir/subdir2", 0777); mkdir(“dir/subdir/subdir2/subdir3”, 0777); FILE* fp = fopen("dir/subdir/subdir2/subdir3/file.txt", "w"); ... fclose(fp);