hi, I found out some code or a way to accomplish my goal, I understand the code 100% but the first problem is when I run the code it throws an Error with the code (123) like:-
FindFirstFile Failed(123)
the second problem is I want to iterate for each file to call a function and within the function, there is an argument this argument is the path
here is the code::-
<pre>static void listfiles() {
WIN32_FIND_DATA FindFileData;
HANDLE hFind = FindFirstFile("C:\\Users\MohamedAlzurghni\source\repos\FileCrypter\Debug", &FindFileData);
if (hFind == INVALID_HANDLE_VALUE) {
printf("FindFirstFile failed (%d)\n", GetLastError());
return;
}
do {
if (FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
printf(TEXT(" %s <DIR>\n"), FindFileData.cFileName);
else
printf(TEXT(" %s \n"), FindFileData.cFileName);
} while (FindNextFile(hFind, &FindFileData) != 0);
FindClose(hFind);
}
[Update] I tried to Fix the Problem and i wrote this:-
WIN32_FIND_DATA data;
HANDLE hFind = FindFirstFile("C:\\Users\MohamedAlzurghni\source\repos\ProjectC++\*", &data);
if (hFind != INVALID_HANDLE_VALUE) {
do {
std::cout << data.cFileName << std::endl;
} while (FindNextFile(hFind, &data));
FindClose(hFind);
}
but there is no output.