Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!uwm.edu!psuvax1!rutgers!att!dptg!ulysses!nsscb!nrg From: nrg@nsscb.UUCP (G.Narotham Reddy) Newsgroups: comp.lang.c Subject: What is wrong with this code ? Message-ID: <1156@nsscb.UUCP> Date: 9 Dec 89 16:46:12 GMT Organization: AT&T NSSC, S.Plainfield, NJ Lines: 30 #include #include #include main(argc,argv) int argc; char *argv[]; { struct stat nfile; stat(argv[1], &nfile); if (nfile.st_mode & S_IFMT == S_IFREG) printf("%s regular file\n", argv[1]); else if (nfile.st_mode & S_IFMT == S_IEXEC) printf("%s executable\n", argv[1]); else if (nfile.st_mode & S_IFMT == S_IWRITE) printf("%s writable\n", argv[1]); else if (nfile.st_mode & S_IFMT == S_IREAD) printf("%s readable\n", argv[1]); else if (nfile.st_mode & S_IFMT == S_IFDIR) printf("%s dir\n", argv[1]); } Thanks -- _________________________________________________________________________ Narotham Reddy reddy@attctc.Dallas.TX.US reddy@nucleus.mi.org reddy@pooh.att.com -------------------------------------------------------------------------