All the way up until there were 100 text files in the folder. How can I randomly grab one of those filenames? I dont need to fstream open the file or anything like that I just want to create a string from its filename. So.
String1 = (one of the filenames from the directory e.g. 7b)
String2 = (another filename from the directory that IS NOT the same as string1)
What would be the easiest/most efficient way of going about that ?
1) Obtain a list of the files in the folder
2) Generate a random number between 1 and 100
3) Find the name at that position in the list
4) Generate a second random number between 1 and 100
5) Find the name at that position in the list
Use FindFirstFile() to find "*.txt". The path of the file name is stored in the LPWIN32_FIND_DATA structure (cFileName). FindFirstFile also returns a handle that you use to continue the search in FindNextFile(). When you have finished the search the best practice is to call FindClose() because this closes the search handle.