CString strPathName,strPathName1,strPathName2,strPathName3;
strPathName="D:\\银行卡识别\\"; strPathName1="D:\\银行卡识别\\pic1\\"; strPathName2="D:\\银行卡识别\\pic2\\"; strPathName3="D:\\银行卡识别\\pic3\\"; int jpgnums = 0; //判断这三个文件夹是否存在,不存要,就创建 if (!PathFileExists(strPathName)) { CreateDirectory(strPathName,NULL); } if (!PathFileExists(strPathName1)) { CreateDirectory(strPathName1,NULL); } if (!PathFileExists(strPathName2)) { CreateDirectory(strPathName2,NULL); } if (!PathFileExists(strPathName3)) { CreateDirectory(strPathName3,NULL); } if(strPathName1!="") { DeleteDirectory2(strPathName1);//如果目录下的内容不为空,就要删除 }
char * filename=new char[100];
strPathName1+="\%d.bmp";
sprintf(filename,strPathName1,m);//把截取的字符保存下来
在调用PathFiIeExists() 或CreateDirectory()函数时,需要包含以下头文件与库函数:
#include "shlwapi.h"
#pragma comment(lib,"shlwapi.lib")