To read in command arguments, the video is correct, you would use argc, the number of arguments passed to the program, and *argv[] or **argv, an array of character string arguments passed.
Here's an example:
Code:
#include <stdio.h>
int main(int argc, char** argv)
{
// get the first argument
// the name of the program
char* first_arg = argv[0];
printf("Name of file: %s\n", first_arg);
// get the second argument
// what you're probably looking for
char* second_arg = argv[1];
printf("Input: %s\n", second_arg);
for (int i = 0; i < argc; i++) {
printf("Argument [%d] %s\n", i, argv[i]);
}
return 0;
}
You can send the program as many arguments as you want. argc will increasse the argument count and **argv will put them in an array.