Home Segments Index Top Previous Next

88: Sidetrip

Later on, in the hardcopy version of this book, you learn about mechanisms that enable you to read data from files. Meanwhile, if you happen to be using Unix or Dos, you may wish to take advantage of the input-redirection mechanism that enables you to tell your program to accept input from a file as though that input were coming from your keyboard.

To supply information from a file, you first prepare a file containing the characters that you would have supplied from your keyboard:

11 9 40 

The command line that redirects input from your keyboard to the file is as follows, assuming that your program's name is box_car, and that your data file's name is test_data:

box_car < test_data