用C++实现简单的文件文件夹创建,当E:\FTP不存在时,创建FTP文件夹。
#include <iostream>
#include <fstream>
#include <direct.h>
#include <windows.h>
using namespace std;
int main()
{
char path[MAX_PATH] = "E:\\FTP";
FILE *fp = NULL;
fp = fopen(path, "r");
if (NULL == fp)
{
if (0 == _mkdir(path))
{
std::cout << "FTP文件创建成功" << std::endl;
}
else
{
std::cout << "FTP文件创建失败" << std::endl;
}
}
else
{
fclose(fp);
}
system("pause");
return 0;
}