Home Segments Index Top Previous Next

400: Mainline

Once you have opened a file for output, you can substitute its stream name instead of cout in output statements. For example, the following output statement writes the volume of one of cylinder objects in the oil_tanks array into the file connected to the stream named volume_stream:

volume_stream << oil_tanks[counter].volume ( ) << endl;