What i Need for c++:
if( fileExists("c:\foo\bar*.txt") ){
cout << "file exists";
}else{
cout << "file does not exists";
}
Its nearly the same as descripted here: How to check a file if exists with wildcard in Java? , but for c++
What i Need for c++:
if( fileExists("c:\foo\bar*.txt") ){
cout << "file exists";
}else{
cout << "file does not exists";
}
Its nearly the same as descripted here: How to check a file if exists with wildcard in Java? , but for c++
Since you haven't specified a platform there are a few options. For POSIX compliant systems there is the answer from this solution (credit his not mine):
You can use the [
glob()
][1] POSIX library function.
alternatively for windows there is this solution:
Link with
setargv.obj
(orwsetargv.obj
) and argv[] will be globbed for you similar to how the Unix shells do it:I can't vouch for how well it does it though.
Or for a simple cross platform library you could try shwild or wildcmp or write your own with the answer to this question.