Testing if file exists?

Mikael Svensson minisip at mikaelsvensson.info
Thu Jun 14 09:36:43 CEST 2007


Hello

I "need" a function that tests whether or not a certain file exists and 
I got a lovely such function off the Internet. It works just fine under 
  Linux, but I'm guessing it won't work as smoothly under Windows.

#include <string>
#include <sys/stat.h>
bool fileExist (std::string filename) {
	struct stat buffer;
	if (stat(filename.c_str(), &buffer)) {
		return false;
	}
	return true;
}


So...

1. Is there already a cross-platform "file existence tester" in Minisip?

2. If not, how could one implement such a function? (I could of course 
Google for one, but perhaps one of you already have an idea...)

Regards
Mikael


More information about the Minisip-devel mailing list