home *** CD-ROM | disk | FTP | other *** search
/ C Programming Starter Kit 2.0 / SamsPublishing-CProgrammingStarterKit-v2.0-Win31.iso / bc45 / streams.pak / STREAM1.CPP < prev    next >
C/C++ Source or Header  |  1997-07-23  |  626b  |  33 lines

  1. // ---------------------------------------------------------------------------
  2. // Copyright (C) 1994 Borland International
  3. //  stream1.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.     T3DPoint p3(7,9,11);
  15.     ofp << &p3;
  16. }
  17.  
  18. void ReadStream()
  19. {
  20.     ifpstream ifp(FileName);
  21.     T3DPoint* p3 = 0;
  22.     ifp >> p3;
  23.     if( p3 )
  24.         p3->Draw();
  25. }
  26.  
  27. int main()
  28. {
  29.     WriteStream();
  30.     ReadStream();
  31.     return 0;
  32. }
  33.