Shouldn't be too hard.
FindFirstFile Function (Windows)
FindNextFile Function (Windows)
WIN32_FIND_DATA Structure (Windows)
The file name is the member 'cFileName' in the WIN32_FIND_DATA structure. From there you can just do a bit of string manipulation to delete the files you want.