Hi to everyone;
  I know just little about C and that was also learnt by reading book for 
beginners i.e. "how to program in C" and also after joined your group that was 
really helpful for beginners. I m doing OS course in Linux where I m not 
understanding the command line. is it like DOS cmd line? And I am too confused 
in cammand_line_arguments like argc and pointer argv. I want to know about each 
and every thing about these, because of this i could not understand the below 
code and similar of it.There are 2 files below.Can anybody explain this code 
specially the main() function with its arguments?Pleaseeee........
  Thanksssssss in Advance.
   asma.
    ___________________________________________________________________
  file1.c
  # include "glob.h"
   
  void sysfail(int rc,char *message)
  {
   
               perror(message);
               exit(rc);
  }
   
  void usrfail(int rc,char *message)
  {
   
               fprintf(stderr,message);
               exit(rc);
  }
   
  _________________________________________________________________________
   
  file2.c
  # include "glob.h"
   
  int main(int argc,char *argv[])
  {
   
  FILE *in;
  int count=0;
  int ch;
   
  if(argc<2)
              usrfail(1,"Command requires a filename");
   
  if((in=fopen(argv[1],"r"))== NULL)
              sysfail(2,argv[1]);
   
  whlie ((ch=getc(in))!=EOF)
         if(ch=='\n')
                  count++;
         fclose(in);
   
  printf("%d\n",count);
  return (0);
  }
   

       
---------------------------------
Park yourself in front of a world of choices in alternative vehicles.
Visit the Yahoo! Auto Green Center.

[Non-text portions of this message have been removed]

Reply via email to