Windows API
Finds the first file in a directory tree that matches the specified attributes and search criteria.
A structure that receives information about the file.
A pointer to a FindFileData structure.
A pointer to a FindFileData structure.
Specifies the search criteria. See FindFirstFileEx for details.
Specifies the search criteria. See FindFirstFileEx for details.
A pointer to a null-terminated string specifying the name of the file to search for. This parameter is optional.
A pointer to a null-terminated string specifying the name of the file to search for. This parameter is optional.
If the function succeeds, returns 0. If the function fails, returns an error code.
If the function succeeds, returns 0. If the function fails, returns an error code.
HANDLE hFile;
DWORD dwError = 0;
FindFileData fileInfo;
hFile = FindFirstFileExW(
"C:\\MyFolder",
&fileInfo,
0,
&dwError
);
if (hFile == INVALID_HANDLE_VALUE)
{
printf("FindFirstFileEx failed with error code: %ld\n", dwError);
}
else
{
printf("File found: %s\n", fileInfo.name);
}
FindClose(hFile);