Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static bool ff_matches() {
- return found.dwFileAttributes == FILE_ATTRIBUTE_NORMAL
- || (ff_attribs ^ found.dwFileAttributes);
- }
- string file_find_first(string name,int attributes)
- {
- if (current_find!=INVALID_HANDLE_VALUE) file_find_close();
- ff_attribs = attributes;
- current_find = FindFirstFile(name.c_str(), &found);
- return ff_matches() ? found.cFileName : file_find_next();
- }
- string file_find_next()
- {
- if (current_find == INVALID_HANDLE_VALUE) return "";
- do {
- if (!FindNextFile(current_find, &found)) {
- current_find = INVALID_HANDLE_VALUE;
- return "";
- }
- } while (!ff_matches());
- return found.cFileName;
- }
- void file_find_close() {
- if (current_find == INVALID_HANDLE_VALUE) return;
- FindClose(current_find);
- current_find = INVALID_HANDLE_VALUE;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement