Reputation: 492
I'm developing a game for mi Advance Algorithm class, but I'm having a problem with the read and save. I want to save the "fields" on a .txt file but on a specific folder in my solution. I want to create 1 file per field, and I want to read all the .txt files on that specific folder when I load the solution. The user must not send any address for saving or reading, that must be done by default by the program. I'm actually using this :
FILE* arch =fopen("Tableros.tbl","wt");
if(arch==NULL)return;
Same thing for reading. But I can only read one file, and I want to detect or read all .txt on that specific folder. Any ideas or functions that can help? I'm using visual studio 2010 c++.
Upvotes: 0
Views: 94
Reputation: 1587
Use GetCurrentDirectory() function to retrieve current process directory. Then use search in the directory (FindFirstFile(), FindNextFile() and other) to detect and read all files in cycle.
Upvotes: 1