Home Segments Index Top Previous Next

398: Mainline

Once you have opened a file for input, you can substitute the corresponding stream name for cin in input statements. For example, the following statement tells C++ to read a radius and a length from the file connected to the stream named cylinder_stream:

cylinder_stream >> radius >> length;