Hello to all.
I want to check a directory, lets call it "ProgramDirectory", for certain files, which we will say are all called filename#.file where # is a number, to see if they already exist. The program is in the directory it is checking but i would also like to know how to do this if it was in a different dircetory. I dont want to do this by opening a file stream and then running a
Code:
if(!ifstream_variable.is_open)
{etc.};
because I want to use the directory search to tell the program what files already exist for it to open. The search needs to be able to search progressively through the file numbers. for example it needs to be able to check if filename1.file exists and if it does then it will check to see if filename2.file exists and so on until a file number doesnt exist. I would also like to know how to search a directory for any filename I specify. I know this is a lot of questions but I greatly appreciate any help. any additional information is welcome and appreciated as well. Also any information even partially pertaining to the question is helpful.

Thanks in advance.

PS
I am new to this forum so if i did something wrong (which i probably did) then i apologize and please let me know so i can fix it or at the least not do it next time.