What is wrong with this code ?

D'Arcy J.M. Cain darcy at druid.uucp
Mon Dec 11 12:12:20 AEST 1989


In article <1156 at nsscb.UUCP> nrg at nsscb.UUCP (G.Narotham Reddy) writes:
>
>#include <stdio.h>
>#include <sys/types.h>
>#include <sys/stat.h>
>
>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 at druid)     |   "You mean druid wasn't taken yet???"
D'Arcy Cain Consulting             |                    - Everybody -
West Hill, Ontario, Canada         |
No disclaimers.  I agree with me   |



More information about the Comp.lang.c mailing list