Check out the MFC class CFile, it has such methods as...Create Creates a new file
Open Opens an existing file.
Close Closes the file.
Read Reads a number of bytes from the file.
Write Writes a number of bytes to the file.
Seek Sets the file position.
GetPosition Returns the current file position.
Flush Flushes all uncommitted data to the file.
GetSize Returns the size of the file.
GetFileTime Returns the file creation-, modification- and access-times.
FileExists Returns whether a filename exists.
Delete Deletes a file.
Rename Renames a file.
FileExists could be a good one, and I believe you can use wildcards such as *.exe. Then just run through a loop and use a counter