argv[0]
is the executable's name and if you've passed 3 arguments in the form of filenames, those will be stored in argv[1]
, argv[2]
and argv[3]
, respectively. So you might want something like:
strcpy(endjogos, argv[1]);
strcat(endjogos, "jogos.txt");
strcpy(endtimes, argv[2]);
strcat(endtimes, "times.txt");
strcpy(endapost, argv[3]);
strcat(endapost, "apostas.txt");
Note that C arrays are zero-indexed, so with argc==4, you have argv[0]
, argv[1]
, argv[2]
, argv[3]
.