home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / stl2vac.zip / STLport-4_5_3.zip / STLport-4.5.3 / test / regression / istmit1.cpp < prev    next >
C/C++ Source or Header  |  2001-03-02  |  1KB  |  38 lines

  1. // STLport regression testsuite component.
  2. // To compile as a separate example, please #define MAIN.
  3.  
  4. #include <iostream>
  5. #include <algorithm>
  6. #include <functional>
  7. #include <iterator>
  8.  
  9. #ifdef MAIN 
  10. #define istmit1_test main
  11. #endif
  12.  
  13. #if !defined (STLPORT) || defined(__STL_USE_NAMESPACES)
  14. using namespace std;
  15. #endif
  16. int istmit1_test(int, char**)
  17. {
  18.   cout<<"Results of istmit1_test:"<<endl;
  19.   char buffer [100];
  20.   int i = 0;
  21.   cin.unsetf(ios::skipws); // Disable white-space skipping.
  22.   cout << "Please enter a string: ";
  23. #ifndef _STLP_LIMITED_DEFAULT_TEMPLATES
  24.   istream_iterator<char> s(cin),meos;        //*TY 01/10/1999 - added eos()
  25. #else
  26.   istream_iterator<char, ptrdiff_t> s(cin),meos;        //*TY 01/10/1999 - added eos()
  27. #endif
  28.   while(!(s == meos)  &&        
  29.     //*TY 01/10/1999 - added end of stream check 
  30.     // NOTE operator!= should not be used here ifndef __STL_FUNCTION_TMPL_PARTIAL_ORDER
  31.           *s != '\n' &&
  32.           (i < sizeof(buffer)/sizeof(buffer[0])) )        //*TY 07/28/98 - added index check
  33.     buffer[i++] = *s++;
  34.   buffer[i] = '\0'; // Null terminate buffer.
  35.   cout << "read " << buffer << endl;
  36.   return 0;
  37. }
  38.