本文整理汇总了C++中vecS::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ vecS::push_back方法的具体用法?C++ vecS::push_back怎么用?C++ vecS::push_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vecS
的用法示例。
在下文中一共展示了vecS::push_back方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetNames
int CmFile::GetNames(CStr &nameW, vecS &names)
{
string dir = GetFolder(nameW);
names.clear();
names.reserve(6000);
DIR *dp = opendir(_S(dir));
if (dp == NULL){
cout << dir << endl;
perror("Cannot open directory");
return EXIT_FAILURE;
}
struct dirent *dirContent;
while ((dirContent = readdir(dp)) != NULL){
if (string(dirContent->d_name)[0] == '.')
continue;
struct stat st;
lstat(dirContent->d_name,&st);
if(S_ISREG(st.st_mode)){
cout << string(dirContent->d_name) << " " << st.st_mode << endl;
names.push_back(string(dirContent->d_name));
}
}
closedir(dp);
return (int)names.size();
}
示例2: GetSubFolders
int CmFile::GetSubFolders(CStr& folder, vecS& subFolders)
{
subFolders.clear();
DIR *dp = opendir(_S(folder));
if (dp == NULL){
cout << folder << endl;
perror("Cannot open folder");
return EXIT_FAILURE;
}
struct dirent *dirContent;
while ((dirContent = readdir(dp)) != NULL){
if (string(dirContent->d_name)[0] == '.')
continue;
struct stat st;
lstat(dirContent->d_name,&st);
if(S_ISDIR(st.st_mode)){
subFolders.push_back(string(dirContent->d_name));
}
}
closedir(dp);
return (int)subFolders.size();
}
示例3: GetNames
int CmFile::GetNames(CStr& rootFolder, CStr &fileW, vecS &names)
{
GetNames(rootFolder + fileW, names);
vecS subFolders, tmpNames;
int subNum = CmFile::GetSubFolders(rootFolder, subFolders);
for (int i = 0; i < subNum; i++){
subFolders[i] += "/";
int subNum = GetNames(rootFolder + subFolders[i], fileW, tmpNames);
for (int j = 0; j < subNum; j++)
names.push_back(subFolders[i] + tmpNames[j]);
}
return (int)names.size();
}
示例4: GetSubFolders
int CmFile::GetSubFolders(CStr& folder, vecS& subFolders)
{
subFolders.clear();
WIN32_FIND_DATAA fileFindData;
string nameWC = folder + "\\*";
HANDLE hFind = ::FindFirstFileA(nameWC.c_str(), &fileFindData);
if (hFind == INVALID_HANDLE_VALUE)
return 0;
do {
if (fileFindData.cFileName[0] == '.')
continue; // filter the '..' and '.' in the path
if (fileFindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
subFolders.push_back(fileFindData.cFileName);
} while (::FindNextFileA(hFind, &fileFindData));
FindClose(hFind);
return (int)subFolders.size();
}