This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: 3/17/2010 1 COMP 1002/1402 Introduction to Systems Programming Chapter 19: Command line Arguments Notes Adapted from Dr. J. Morrison, Dr D. Nussbaum Purpose At times a program needs to know some information during startup. Examples: A gaming program needs to know the maximum number of players that will participate. A file copy program needs to know the input file (from file) and the output file (to file). A bilingual program needs to know in which language to present the information to the user. COMP1002/1402 - Chapter 19: Command-line Arguments 2 3/17/2010 2 Examples Manual pages: man printf List the files in the directory: ls l Copy files: cp infile outfile Compiling using make: make f myMakeFile COMP1002/1402 - Chapter 19: Command-line Arguments 3 What is Needed Transfer the required input from the command line: > program arg1 arg2 arg3 The operating system, which starts the program must transfer the parameters to the...
View Full Document
- Spring '10