public member function
<istream> <iostream>
std::basic_istream::basic_istream initialization (1)explicit basic_istream (basic_streambuf<char_type,traits_type>* sb);initialization (1)
explicit basic_istream (basic_streambuf<char_type,traits_type>* sb);copy (2)
basic_istream& (const basic_istream&) = delete;move (3)
protected: basic_istream& (basic_istream&& x);
Construct object
Constructs a basic_istream object.1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// istream constructor
#include <iostream> // std::ios, std::istream, std::cout
#include <fstream> // std::filebuf
int main () {
std::filebuf fb;
if (fb.open ("test.txt",std::ios::in))
{
std::istream is(&fb);
while (is)
std::cout << char(is.get());
fb.close();
}
return 0;
}
test.txt
. The buffer is passed as parameter to the constructor of the basic_istream object is, associating it to the stream. Then, the program uses the input stream to print its contents to cout.
Objects of basic_istream classes are seldom constructed directly. Generally some derived class is used (like the standard basic_ifstream or basic_istringstream).
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