当前位置: 代码迷 >> 综合 >> vc++新建文件夹代码
  详细解决方案

vc++新建文件夹代码

热度:80   发布时间:2024-01-21 08:42:51.0

#include <string>
#include <iostream>
#include <shlobj.h>
#include <tchar.h>
#include <io.h>
#include <direct.h>
using namespace::std;

int main() {
  
char *fileName="E:\\新建\\xinjian01\\",*tag;
char buf[1000],path[1000];
for(tag=fileName;*tag;tag++)
{
   if (*tag=='\\')
   {
   
    strcpy(buf,fileName);
    buf[strlen(fileName)-strlen(tag)+1]=NULL;
    strcpy(path,buf);
    if (access(path,6)==-1)
    {
     mkdir(path);
    }
 
   }
 
}
 
 printf("%s",path);
   system("PAUSE");
    return 1;
}

  相关解决方案