Ask your own question, for FREE!
Computer Science 4 Online
OpenStudy (anonymous):

hi i'm writing a c program to parse argc and argv.

OpenStudy (anonymous):

#include<stdio.h> int main(int argc, char *argv[]){ printf("Your name is : %s\n", argv[1]); } And then from the command line write as follow : ./name nyeung The result will be : Your name is : nyeung Good luck.

OpenStudy (rsmith6559):

If you're actually parsing argv, strtok and getopts will be invaluable.

OpenStudy (anonymous):

What @rsmith6559 said. Unless this is for a class and you can't use the right tool for the job, don't reinvent the wheel. That program is already written and it is getopt.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!