4 ms·
You are correct. The actual pattern you want to use in practice with this API is more of a do ... while: WIN32_FIND_DATA data; HANDLE handle; hand
by asveikau 8y ago
You are correct. The actual pattern you want to use in practice with this API is more of a do ... while:
WIN32_FIND_DATA data;
HANDLE handle;
handle = FindFirstFile(str, &data);
// TODO - error check
do
{
// TODO: process "data" which is a file.
} while (FindNextFile(handle, &data));
FindClose(handle);
So the loop body is the same for the "first" and "next" files.