CSC 161 Grinnell College Spring, 2015
Imperative Problem Solving and Data Structures

CSC 161 Module on Integrated Robotics

Summary and Main Topics

The purpose of this module is to smoothly integrate and review material that has been presented through the semester, with a particular emphasis on C programming concepts and full usage of the Scribbler robot.

  1. Command-Line Arguments
  2. Files
  3. Logging Commands

Day-by-day Details

Day Topic Preparation In-class Due Date Availability
Wednesday, April 29 Command-Line Arguments lab exercise    
Friday, May 1 Files
  • King, Sections 22.1-22.3
  • K&R 7.5 - 7.8
lab exercise    
Monday, May 4 Files Continued lab exercise   extra credit if submitted by Friday, May 8
Tuesday, May 5 Supplemental Problem 5   Supplemental Problem 5 (done individually) Tuesday, May 5  
Tuesday, May 5 Project Day 1   project Friday, May 8  
Wednesday, May 6 Project Day 2   project Friday, May 8  

Project: Robot Logging Suite

Write a "robot logger" program which can log actions to a file, and also read actions from a file and performs them.


The following examples are based on a program proj111 that supports this project. Although this table shows several possibilities, the table is not complete. For example, various combinations of -r and -w are possible, with and without file names, and the -r and -w flags could be in either order.

Command line Interpretation
proj111 no command-line arguments, so reads from terminal and writes to terminal
proj111 -r infile.dat reads commands from file infile.dat; writes to terminal
proj111 -r reads from a file; since filename not given on the command line, program must ask user what file to use; program writes to terminal
proj111 -w logfile.dat reads from terminal; writes commands with parameters to file logfile.dat
proj111 -w reads from terminal; writes commands with parameters to a file; since file name not given on command line, program must ask what file to use
proj111 -w logfile.dat -r infile.dat
proj111 -r infile.dat -w logfile.dat
reads commands from infile.dat, writes commands with parameters to infile.dat
proj111 -r infile -w reads commands from infile.dat; writes comands with parameters to a file; since log file name not specified, user must be asked for the filename