• Home
  • History
  • Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "test_macros.h"
19 #include "platform_support.h"
20 
main(int,char **)21 int main(int, char**)
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   return 0;
38 }
39