Here are the two functions I often missed in the windows C/C++ libraries …
#include <sys/types.h>
#include <sys/stat.h>
bool file_exists(const TCHAR* lspzFile) {
int i;
struct _stat s;
if(!lspzFile) return false;
i = _tstat(lspzFile, &s);
if(!i && (s.st_mode & _S_IFREG) != 0)
return true;
else
return false;
}
bool dir_exists(const TCHAR* lspzDirectory) {
int i;
struct _stat s;
if(!lspzDirectory) return false;
i = _tstat(lspzDirectory, &s);
if(!i && (s.st_mode & _S_IFDIR) != 0)
return true;
else
return false;
}
Ciao Ephraim