本文整理汇总了C++中CFindFile::FindFirst方法的典型用法代码示例。如果您正苦于以下问题:C++ CFindFile::FindFirst方法的具体用法?C++ CFindFile::FindFirst怎么用?C++ CFindFile::FindFirst使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFindFile
的用法示例。
在下文中一共展示了CFindFile::FindFirst方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Find
// #ifndef _UNICODE
bool CFileInfoW::Find(LPCWSTR wildcard)
{
#ifdef SUPPORT_DEVICE_FILE
if (IsDeviceName(wildcard))
{
Clear();
IsDevice = true;
NIO::CInFile inFile;
if (!inFile.Open(wildcard))
return false;
Name = wildcard + 4;
if (inFile.LengthDefined)
Size = inFile.Length;
return true;
}
#endif
CFindFile finder;
return finder.FindFirst(wildcard, *this);
}
示例2: TestFF
void CMacFindFile::TestFF(const char *directorypath, const char *pfilter)
{
CFindFile* pFileFinder =NULL;
char * pszDllName;
int count = 0;
CHXString s1;
Str255 s1Pasc;
pFileFinder = CFindFile::CreateFindFile(directorypath, 0, pfilter);
pszDllName = pFileFinder->FindFirst();
while (pszDllName)
{
count ++;
CHXString s2;
s2.Format("%s: %d %s\r", pfilter, (short) count, pszDllName);
if (s1.GetLength() + s2.GetLength() > 255)
{
s1.MakeStr255(s1Pasc);
DebugStr(s1Pasc);
s1.Empty();
}
s1 += s2;
char *path = pFileFinder->GetCurFilePath();
char *filename = pFileFinder->GetCurFilename();
char *dirpath = pFileFinder->GetCurDirectory();
pszDllName = pFileFinder->FindNext();
}
delete pFileFinder;
s1.MakeStr255(s1Pasc);
DebugStr(s1Pasc);
}
示例3: FindFile
bool FindFile(LPCWSTR wildcard, CFileInfoW &fileInfo)
{
CFindFile finder;
return finder.FindFirst(wildcard, fileInfo);
}
示例4: Find
//.........这里部分代码省略.........
if (si.Name.Len() > kPostfixSize + 1)
si.Name.DeleteFrom(si.Name.Len() - kPostfixSize);
Name += us2fs(si.Name);
Size = si.Size;
IsAltStream = true;
return true;
}
}
}
}
#endif
CFindFile finder;
#if defined(_WIN32) && !defined(UNDER_CE)
{
/*
DWORD lastError = GetLastError();
if (lastError == ERROR_FILE_NOT_FOUND
|| lastError == ERROR_BAD_NETPATH // XP64: "\\Server\Share"
|| lastError == ERROR_BAD_NET_NAME // Win7: "\\Server\Share"
|| lastError == ERROR_INVALID_NAME // XP64: "\\?\UNC\Server\Share"
|| lastError == ERROR_BAD_PATHNAME // Win7: "\\?\UNC\Server\Share"
)
*/
unsigned rootSize = 0;
if (IsSuperPath(path))
rootSize = kSuperPathPrefixSize;
if (NName::IsDrivePath(path + rootSize) && path[rootSize + 3] == 0)
{
DWORD attrib = GetFileAttrib(path);
if (attrib != INVALID_FILE_ATTRIBUTES && (attrib & FILE_ATTRIBUTE_DIRECTORY) != 0)
{
ClearBase();
Attrib = attrib;
Name = path + rootSize;
Name.DeleteFrom(2); // we don't need backslash (C:)
return true;
}
}
else if (IS_PATH_SEPAR(path[0]))
if (path[1] == 0)
{
DWORD attrib = GetFileAttrib(path);
if (attrib != INVALID_FILE_ATTRIBUTES && (attrib & FILE_ATTRIBUTE_DIRECTORY) != 0)
{
ClearBase();
Name.Empty();
Attrib = attrib;
return true;
}
}
else
{
const unsigned prefixSize = GetNetworkServerPrefixSize(path);
if (prefixSize > 0 && path[prefixSize] != 0)
{
if (NName::FindSepar(path + prefixSize) < 0)
{
FString s = path;
s.Add_PathSepar();
s += FCHAR_ANY_MASK;
bool isOK = false;
if (finder.FindFirst(s, *this))
{
if (Name == FTEXT("."))
{
Name = path + prefixSize;
return true;
}
isOK = true;
/* if "\\server\share" maps to root folder "d:\", there is no "." item.
But it's possible that there are another items */
}
{
DWORD attrib = GetFileAttrib(path);
if (isOK || attrib != INVALID_FILE_ATTRIBUTES && (attrib & FILE_ATTRIBUTE_DIRECTORY) != 0)
{
ClearBase();
if (attrib != INVALID_FILE_ATTRIBUTES)
Attrib = attrib;
else
SetAsDir();
Name = path + prefixSize;
return true;
}
}
// ::SetLastError(lastError);
}
}
}
}
#endif
return finder.FindFirst(path, *this);
}