Unifix knowledge database - The original one

Dashboard - News - Search - List - About - Admin


Taking command line arguments in C

Author:mike - Sat Aug 9 20:35:31 2003

bash$ cat vladimirr.c 
int main(argc, argv)
        int             argc;
        char          **argv;
{
        int     i;
        for (i=0; i<=argc; i++)
        {
                printf("Argument[%i]=%s\n",i,argv[i]);
        }
}

bash$ cc vladimirr.c -o vladimirr
bash$ ./vladimirr er en gammel torsk som stinker til c
Argument[0]=./vladimirr
Argument[1]=er
Argument[2]=en
Argument[3]=gammel
Argument[4]=torsk
Argument[5]=som
Argument[6]=stinker
Argument[7]=til
Argument[8]=c
Argument[9]=(null)


Dedikeret til vores alles elskede vladimirr :)
Copyright(c) Unifix.org 2002-2011


Dashboard - News - Search - List - About - Admin
 
Powered by Mikjaer Consulting Solutions - Hosted by Specialhosting.dk