-5

I have problem with the number of argc that passed to program
so, when i check the argc it's not equal to 2 !!
need help, how can i solve that problem ?

C code snippet :

if (2 != argc) {
    fprintf(stderr, "Usage: %s <port>\n", argv[0]);
    exit(1);
}
OmnipotentEntity
  • 16,531
  • 6
  • 62
  • 96

1 Answers1

6

Don't forget that the program name itself counts as an arg.

myProgram -flag variable is an argc of 3

octal9
  • 368
  • 1
  • 10