Home Segments Index Top Previous Next

676: Mainline

You could supply a value for mode via a command-line argument. It is more likely, however, that you want to vary the speed-versus-accuracy tradeoff of your program as it is running, especially if your program is in an endlessly repeating loop of the sort you saw in Segment 573. Each time through the loop, you could ask the program user to supply a value for mode via the keyboard. Alternatively, you could use functions found in C's time library to keep track of how fast your program is handling files, switching from accurate to fast computing if necessary to keep up with changing information.