Write (>>=)

Write is the main function for writing data out to a stream. It writes the data type directly to the stream. You should only use this call if no pointers to other instances are involved. If you need to stream a pointer, then use the polymorphic functions so the appropriate data is written.

The CommonPoint application system provides this global function for the primitive data types previously mentioned. For example, the following code segment shows how each stream type writes data. When the >>= function is used, it really performs f.write(x).

      long x=5;       // sample data in known type
      TFileStream f;  // sample stream
      x >>= f;      // does f.write(x)
NOTE Remember to write out the "version number" associated with this instance. These version numbers are updated whenever the external representation of the instance changes. Your stream in function looks at this when reading and takes the appropriate action. You must read in all old versions.


[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