Code:
std::string GetFile(const std::string &path)
{
	WIN32_FIND_DATA wfd;
	static HANDLE hFind;
	
	if(path=="")
	{
		// We are getting another file
		if(FindNextFile(hFind, &wfd) == FALSE) return(""); 
		while(wfd.dwFileAttributes == FILE_ATTRIBUTE_DIRECTORY)
		{
			if(FindNextFile(hFind, &wfd) == FALSE) return("");
		}
	}
	else
	{
		// We are getting the first file
		hFind = FindFirstFile(path.c_str(), &wfd);
		if(hFind == INVALID_HANDLE_VALUE) return("");

	}
	
	return(wfd.cFileName);
}
I am using the above function to return filenames, I don't want it to return dirs. The problem is that it still returns some dirs (ones like Program Files and Recycle folders) any idea why?

Thankyou