Concrete Geist
11-29-2001, 06:02 PM
Whenever I use one of these it tells me Invalid operand to binary &
How am I supposed to use these??
S_ISREG(m)
S_ISDIR(m)
S_ISCHR(m)
S_ISBLK(m)
S_ISFIFO(m)
S_ISLNK(m)
S_ISSOCK(m)
debiandude
11-29-2001, 10:42 PM
Um I don't know what you were trying to do by getting that error. The only thing I could that maybe you were trying to do was pass it a file pointer. You can't directly do that, you have to first fstat the file after you did open on it. Anyway here is a brief example:
int main(void) {
#include <stdio.h>
#include <sys/stat.h>
int main(void) {
struct stat *buf;
stat("/home/michael/test.c", buf);
if(S_ISREG(buf->st_mode)) {
printf("It's a reg one man.\n");
}
return 0;
}