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" );
}