pwd
A1.txt
I want to do this.
std::ifstream in("A*.txt");
Is there any method of doing this?
pwd
A1.txt
I want to do this.
std::ifstream in("A*.txt");
Is there any method of doing this?
There is no filename matching functionality in the C++ standard library.
POSIX provides the glob
function in the glob.h
header. Non-POSIX systems may have their own API for filename matching which may or might not differ from POSIX in behaviour.
If you cannot rely on non (C++) standard functionality, then you could of course implement filename matching yourself. However, prior to the upcoming C++17 standard, there is no way to get the file listing of a directory using the C++ standard library, so until then you have to rely on a platform specific API (or a wrapper library).