Reading (<<=)

Read is the main function for reading information in from a stream. The read function must read in data in the exact same order as the write function which wrote it out. When you stream out a set of objects, you must be prepared to resurrect them in the same order. For example give objects a, b, and c which have been written to a stream, you must read the stream back into matching variables for a, b, and c, in order when reading the streamed objects back into a program's memory space. Using the same stream in the write example above , the following code shows how to read from a stream into a variable.

      long y;     // variable to read into
      y <<= f;    // do f.read(y)

[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker