Programming Exercises
Write a file copy program that takes the original filename and the copy file from the command line. Use standard I/O and the binary mode, if possible.
Write a program that sequentially displays onscreen all the files listed in the command line. Use argc to control a loop.
Modify the program in Listing 12.6 so that it uses a command-line interface instead of an interactive interface.
Programs using command-line arguments rely on the user's memory of how to use them correctly. Rewrite the program in Listing 12.2 so that, instead of using command-line arguments, it prompts the user for the required information.
Write a program that opens two files whose names are provided by command-line arguments.
Have the program print line 1 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access