A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.tutorialspoint.com/cpp_standard_library/cpp_fstream_rdbuf.htm below:

C++ fstream rdbuf

C++ Fstream Library - rdbuf Function Description

It returns a pointer to the internal filebuf object.

Declaration

Following is the declaration for fstream::rduf.

C++11
filebuf* rdbuf() const;
Return Value

It returns a pointer to the internal filebuf object.

Exceptions

Strong guarantee − if an exception is thrown, there are no changes in the stream buffer.

Data races Example

In below example explains about fstream rdbuf function.

#include <fstream>
#include <cstdio>

int main () {
   std::fstream src,dest;
   src.open ("test.txt");
   dest.open ("copy.txt");

   std::filebuf* inbuf  = src.rdbuf();
   std::filebuf* outbuf = dest.rdbuf();

   char c = inbuf->sbumpc();
   while (c != EOF) {
      outbuf->sputc (c);
      c = inbuf->sbumpc();
   }

   dest.close();
   src.close();

   return 0;
}

fstream.htm


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4