Path: utzoo!attcan!telly!nebulus!druid!darcy From: darcy@druid.uucp (D'Arcy J.M. Cain) Newsgroups: comp.lang.c Subject: Re: What is wrong with this code ? Message-ID: <1989Dec11.011220.28366@druid.uucp> Date: 11 Dec 89 01:12:20 GMT References: <1156@nsscb.UUCP> Reply-To: darcy@druid.UUCP (D'Arcy J.M. Cain) Organization: D'Arcy Cain Consulting, West Hill, Ontario Lines: 40 In article <1156@nsscb.UUCP> nrg@nsscb.UUCP (G.Narotham Reddy) writes: > >#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]); >} > You forgot to put a smiley in this message (I hope). In case this is a serious question here is my $0.02 1: There is no indentation. 2: There isn't enough white space. 3: It's inefficient. 4: It's rather useless. P.S: :-) -- D'Arcy J.M. Cain (darcy@druid) | "You mean druid wasn't taken yet???" D'Arcy Cain Consulting | - Everybody - West Hill, Ontario, Canada | No disclaimers. I agree with me |