使用C语言如何新建目录?

Python027

使用C语言如何新建目录?,第1张

新建目录的方法:

#include <direct.h>

#include <stdlib.h>

#include <stdio.h>

int main( void )

{

if( _mkdir( "\\testtmp" ) == 0 )

{

printf( "Directory '\\testtmp' was successfully created\n" )

system( "dir \\testtmp" )

if( _rmdir( "\\testtmp" ) == 0 )

printf( "Directory '\\testtmp' was successfully removed\n" )

else

printf( "Problem removing directory '\\testtmp'\n" )

}

else

printf( "Problem creating directory '\\testtmp'\n" )

}

删除目录int rmdir(const char *paht)函数

建立目录int mkdir(const char *paht)函数

似乎没有改目录名的函数

你可以建立一个临时目录,将345目录下的文件拷贝过去,然后删除345目录,再建立一个123目录,然后将文件拷贝到123目录里就ok了啊

亲你好,c 语言 按路径创建文件夹 - ETFW的博客 - CSDN博客 - c 创建文件夹

1. = (stat(folderName, &buffer) == 0)//判断文件夹是否存在,不存在创建if (a==0) { _mkdir

2. = (stat(strCat, &buffer) == 0)//判断文件夹是否存在,不存在创建if (b == 0) { _

3. == 0) { _mkdir(strCat)//不存在则创建} free(strCat。