OK, so I'm working on a project for my class, and I have a problem.
They ask us to keep data files within a folder. The user is supposed to input the folder name and then the program should find x amount of files and then extract the data from them. How do I do that? Thanks in advance!
*PLEASE NOTE: I am a beginner with <fstream>, so please keep your answer as simplified as possible. *
Well, you can basically pass the path of the file to the fstream.
For example, instead of simply doing something like: fstream file("myfile.txt");
You can do something like: fstream file("C:\mystuff\myfile.txt");
Although...I don't think there is a simple way to "scan" a directory and get the filenames out of it...try searching the forum, I think it has been asked before.
to find files in a directory use opendir, readdir and closedir function (on linux, unix)
to find files on windows use FindFirstFile, FindNextFile() class of functions.
these functions will open a directory for you and return each file/folder in that directory one by one. then you can open these file and can read data.