Unix/Linux: ========== hercules[1]% toymem in1.txt toymem is argv[0] in1.txt is argv[1] argc is 2 because there are two words on the line Often specific programs look for optional arguments starting with a "-" Example: ls -lR argc is 2 argv[0] = ls argv[1] = -lR The ls.c program has code that sorts out that a "-lR" has a specific meaning. Command window in Windows: ========================= If you run the program from the command prompt, it's the same as Unix except /arg is usually used instead of -arg. VisualC++ Environment: ===================== Briefly: Assuming you have a "Console" application in Visual C++. If you run the program from the VC++ IDE, the select Project/Settings then select the Debug tab. It contains a field called Progam Arguments -- you can also put I/O redirection, such as < or >, in there if you like. In more detail: ==> Go to Project \ Settings Note: the "Settings" choice is the last choice when you click on "Project". Sometimes it is preceded by the name of your program; e.g. if your program is called Main, then it is called "Main Settings" ==> Choose the Debug tab Then fill in the "Program Arguments" field with the words that should follow the command name. By the way, you enter these words with spaces between them. Don't put in commas or any other punctuation between them. Example: myfile.txt myotherfile.txt Note: Once you have set the arguments, they stay the same, across multiple executions of your program, until you change them. - Another example: In Project / Settings / Debug / Program Arguments put this text: in1-01.txt out1-01.txt to pass the two file names to the main function of your program as argv[1] and argv[2].