home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1998 May / Pcwk5b98.iso / Borland / Cplus45 / BC45 / STREAMS.PAK / STREAM2.CPP < prev    next >
C/C++ Source or Header  |  1995-08-29  |  645b  |  33 lines

  1. // ---------------------------------------------------------------------------
  2. // Copyright (C) 1994 Borland International
  3. //  stream2.cpp
  4. //    Must link with strmpnt.cpp
  5. // ---------------------------------------------------------------------------
  6.  
  7. #include "strmpnt.h"
  8.  
  9. const char* FileName = "stream.dat";
  10.  
  11. void WriteStream()
  12. {
  13.     ofpstream ofp(FileName);
  14.     T2DPointColor p2c(7,9,0,1,2);
  15.     ofp << &p2c;
  16. }
  17.  
  18. void ReadStream()
  19. {
  20.     ifpstream ifp(FileName);
  21.     T2DPointColor* p2c = 0;
  22.     ifp >> p2c;
  23.     if( p2c )
  24.         p2c->Draw();
  25. }
  26.  
  27. int main()
  28. {
  29.     WriteStream();
  30.     ReadStream();
  31.     return 0;
  32. }
  33.