Home | History | Annotate | Download | only in depr.strstreambuf.cons
      1 //===----------------------------------------------------------------------===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is dual licensed under the MIT and the University of Illinois Open
      6 // Source Licenses. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 
     10 // <strstream>
     11 
     12 // class strstreambuf
     13 
     14 // strstreambuf(const signed char* gnext_arg, streamsize n);
     15 
     16 #include <strstream>
     17 #include <cassert>
     18 
     19 int main()
     20 {
     21     {
     22         const signed char buf[] = "abcd";
     23         std::strstreambuf sb(buf, sizeof(buf));
     24         assert(sb.sgetc() == 'a');
     25         assert(sb.snextc() == 'b');
     26         assert(sb.snextc() == 'c');
     27         assert(sb.snextc() == 'd');
     28         assert(sb.snextc() == 0);
     29         assert(sb.snextc() == EOF);
     30     }
     31     {
     32         const signed char buf[] = "abcd";
     33         std::strstreambuf sb(buf, 0);
     34         assert(sb.sgetc() == 'a');
     35         assert(sb.snextc() == 'b');
     36         assert(sb.snextc() == 'c');
     37         assert(sb.snextc() == 'd');
     38         assert(sb.snextc() == EOF);
     39     }
     40 }
     41