• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 // <fstream>
11 
12 // template <class charT, class traits = char_traits<charT> >
13 // class basic_ofstream
14 
15 // basic_filebuf<charT,traits>* rdbuf() const;
16 
17 #include <fstream>
18 #include <cassert>
19 #include "platform_support.h"
20 
main()21 int main()
22 {
23     std::string temp = get_temp_file_name();
24     {
25         std::ofstream fs(temp.c_str());
26         std::filebuf* fb = fs.rdbuf();
27         assert(fb->sputc('r') == 'r');
28     }
29     std::remove(temp.c_str());
30     {
31         std::wofstream fs(temp.c_str());
32         std::wfilebuf* fb = fs.rdbuf();
33         assert(fb->sputc(L'r') == L'r');
34     }
35     std::remove(temp.c_str());
36 }
37