Okay so for school, I'm supposed to write a short programm that searches a given directory for files that have a name-tag thats like "AA[...].dat", "AA[...].sel", "AA[...].ilk" and "AA[...].out". There are a lot of other files in there, but I'm only interested in those that start with "AA".
#include <windows.h>
#include <iostream>
int main(int argc, char* argv[])
{
WIN32_FIND_DATA search_data;
memset(&search_data, 0, sizeof(WIN32_FIND_DATA));
HANDLE handle = FindFirstFile("\\\\P_SERVER\\Input\\*.dat*", &search_data);
while (handle != INVALID_HANDLE_VALUE)
{
std::cout << search_data.cFileName << " --- " << search_data.nFileSizeHigh << "\n";
if (FindNextFile(handle, &search_data) == FALSE)
break;
}
//Close the handle after use or memory/resource leak
FindClose(handle);
system("pause");
return 0;
}
This is what i've come up with so far, it perfectly displays all .sel files in that folder.
But how do i make it search only for files that start with "AA"? And how can i implement a comparison, so it only displays the files that are not complete? (every file starting with "AA" has .dat, .sel, .ilk and .out) Only those files that have only a .dat in this folder are what I'm looking for.