How do i check in C++ if a file is a regular file (and is not a directory, a pipe, etc.)? I need a function isFile().
DIR *dp;
struct dirent *dirp;
while ((dirp = readdir(dp)) != NULL) {
if ( isFile(dirp)) {
cout << "IS A FILE!" << endl;
i++;
}
I've tried comparing dirp->d_type with (unsigned char)0x8, but it seems not portable through differents systems.