-
Reading operands
How do you read the string typed after the command in the terminal? For example, to open the page "http://cboard.cprogramming.com/", you could type into the terminal:
$ firefox http://cboard.cprogramming.com/
In standard sequential C, how do you get the program to read the operand?
-
Code:
#include <stdio.h>
int main(int argc, char *argv[])
{
if (argc > 1)
{
const char *firstArgument = argv[1];
printf("First argument: %s\n", firstArgument);
}
return 0;
}
-
Thank you very much, I thought it would be something like that, but I was not sure.