1. 请问怎么用C语言编写一个创建文件夹的函数
用_mkdir即可,不过需要调用direct.h头文件,下面举个例子
#include <direct.h>
#include <stdlib.h>
#include <stdio.h>
int main( void )
{
if( _mkdir( "\\testtmp" ) == 0 )//0表示创建成功
{
printf( "Directory '\\testtmp' was successfully created\n" );
system( "dir \\testtmp" );//执行dos语句打开文件夹
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" );
}