C/C++???ж????????????????
???????????? ???????[ 2015/4/9 12:00:50 ] ????????C++ ??? ?? ???? API
????3.??windows??????API????FindFirstFile(...):
????(1)????????????:
#define _WIN32_WINNT 0x0400
#include "windows.h"
int
main(int argc?? char *argv[])
{
WIN32_FIND_DATA FindFileData;
HANDLE hFind;
printf ("Target file is %s. "?? argv[1]);
hFind = FindFirstFile(argv[1]?? &FindFileData);
if (hFind == INVALID_HANDLE_VALUE) {
printf ("Invalid File Handle. Get Last Error reports %d "?? GetLastError ());
} else {
printf ("The first file found is %s "?? FindFileData.cFileName);
FindClose(hFind);
}
return (0);
}
????(2)??????????????
///??????????飺
bool CheckFolderExist(const string &strPath)
{
WIN32_FIND_DATA wfd;
bool rValue = false;
HANDLE hFind = FindFirstFile(strPath.c_str()?? &wfd);
if ((hFind != INVALID_HANDLE_VALUE) && (wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
{
rValue = true;
}
FindClose(hFind);
return rValue;
}
4.???boost??filesystem????exists????
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/convenience.hpp>
int GetFilePath(std::string &strFilePath)
{
string strPath;
int nRes = 0;
//???·??
strPath = "D:/myTest/Test1/Test2";
namespace fs = boost::filesystem;
//·????????
fs::path full_path( fs::initial_path() );
full_path = fs::system_complete( fs::path(strPath?? fs::native ) );
//?ж??????????????????????????????
if ( !fs::exists( full_path ) )
{
// ???????????
bool bRet = fs::create_directories(full_path);
if (false == bRet)
{
return -1;
}
}
strFilePath = full_path.native_directory_string();
return 0;
}
???????????????????????漰???????????????????SPASVOС??(021-61079698-8054)?????????????????????????
??????
??C++????????????C++ lvalue??rvalueC++11????????C++???????????????C++?е?????????????????C++?????????C++???Windows????λ??C/C++???????????????????JAVA??C??C++??????????c++??python???????????????????????????????C++???????C++?е????????C++????????????????C++ ???????????????C++?????????????????????C++????????????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11????????
?????????App Bug???????????????????????Jmeter?????????QC??????APP????????????????app?????е????????jenkins+testng+ant+webdriver??????????????JMeter????HTTP???????Selenium 2.0 WebDriver ??????