there is what's called command line arguments and they have also like a
counter , Argv is the variable itself and the Argc is the counter , read
some more about Linux programming .
And any help if you have some trouble.

On 7/9/07, asma sabir <[EMAIL PROTECTED]> wrote:
>
>   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.Cananybody 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]
>
>  
>



-- 
|Mina r. Fahmy|
------------------------------------------------------------------------------------------
GNU/Linux registered user #312544 * Debian 3.1 Sarge * PC
http://mina-fahmy.blogspot.com
Linux Network Consultant member
===============================================================
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)

iD8DBQFDjwHQS45JQJZP7ZQRAmUDAJ9Q8cUGdii55uGM2uQJj7ICUqGTwACgm78g
rYYpiMdrJW0XS+Xou15bREE=
=m1Lp
-----END PGP SIGNATURE-----

=============
Key ID: 0x964F ED94 on --keyserver http://wwwkeys.eu.pgp.net
Key fingerprint = 35DD 3279 EB3E A711 1205  466F 4B8E 4940 964F ED94
===============================================================


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

Reply via email to