1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 // <fstream>
10 
11 // template <class charT, class traits = char_traits<charT> >
12 // class basic_ofstream
13 
14 // basic_filebuf<charT,traits>* rdbuf() const;
15 
16 #include <fstream>
17 #include <cassert>
18 #include "platform_support.h"
19 
20 int main(int, char**)
21 {
22     std::string temp = get_temp_file_name();
23     {
24         std::ofstream fs(temp.c_str());
25         std::filebuf* fb = fs.rdbuf();
26         assert(fb->sputc('r') == 'r');
27     }
28     std::remove(temp.c_str());
29     {
30         std::wofstream fs(temp.c_str());
31         std::wfilebuf* fb = fs.rdbuf();
32         assert(fb->sputc(L'r') == L'r');
33     }
34     std::remove(temp.c_str());
35 
36   return 0;
37 }
38