Hi:
So I'm trying to match a string against a wildcard to see whether they match. I'm using a snippet found here: http://www.planet-source-code.com/vb...=1680&lngWId=3
However, this doesn't seem to be working. My code implementation is as follows:
allFiles is a vector with a directory listing of that directory. files is a string containing the wildcard (so like t*.cpp).Code:for (int i = 0; i < allFiles.size(); i++) { char *buf1 = new char[allFiles[i].size() + 1]; char *buf2 = new char[files.size() + 1]; strcpy(buf1, allFiles[i].c_str()); strcpy(buf2, files.c_str()); cout <<allFiles[i] <<" " <<wildcmp(buf1, buf2) <<endl; if (wildcmp(buf1, buf2)) { searchFile(allFiles[i]); } }
Please let me know what's going on. wildcmp always returns 0.
Thanks.



LinkBack URL
About LinkBacks



.