Today is NOT a LAB day, but we will meet in the lab as usual.
Today, I will talk about a special feature of the C programming language that allows you to make your C program look like a command, called the command line interface.
Things we will discuss:
./add 12 33
and presumably the program would print out "45". Up to now, we would have
had to run the program, then ask the user to enter the two numbers, and
use scanf() to read the numbers.
int main ( int argc, char *argv[] )
./add 12 33
argc will be 3.
./add 12 33
argv[0] will be "./add", argv[1] will be "12" and argv[2] will be "33".
Example: report_args.c
Programs we might discuss:
./copyfile original.txt copy.txt