Questions tagged [argv]

Argument vector containing the arguments passed in from the command line when starting a program. Used in the main method, in conjunction with argc.

argv stands for arguments vector, and represents the arguments given to the program, or main, in a command-line. It is used in conjunction with , the number of arguments given to a program.

Keep in mind that the first value in argv contains the program name.

Example usage:

int main(int argc, char **argv) {
    /* Some code involving command-line arguments from argv */
}

Notable Stack Overflow questions:

1247 questions
-7
votes
1 answer

main(int argc, char *argv[]) compromises my program

First, I should tell you that I use DEV C++ to write my program. Ok, to the point now... I wrote a program that gets input from a file named "candidates1.txt". So, the first lines are: main() { FILE *fp; fp = fopen("candidates1.txt", "r"); …
Grabenfly
  • 13
  • 5
-8
votes
3 answers

c++ only allow certain parameters to placed in argv[1]

Im trying to write some code that will only let one of four letters be entered in the argv[1] parameter. if it is another character the letter q should come up. so ive written #include #include char D, A , R, B; if(argv[1] !=…
dorie
  • 1
1 2 3
83
84