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_operator.htm below:

C++ fstream Operator

C++ Fstream Library - Operator= Function Description

It supported feature version of C++ 11 standard. It acquires the contents of right hand side, by move-assigning its members and base classes.

Declaration

Following is the declaration for fstream::operator=

C++11
copy (1)	fstream& operator= (const fstream&) = delete;
move (2)	fstream& operator= (fstream&& rhs);
Parameters

rhs − Another fstream object.

Return Value

It returns *this.

Exceptions

No-throw guarantee − this member function never throws exceptions.

Data races

It modifies both stream objects (*this and rhs).

Example

In below example explains about fstream operator= function.

#include <fstream>

int main () {
   std::fstream foo;
   std::fstream bar ("test.txt");

   swap(foo,bar);

   foo << "tutorialspoint";

   foo.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