Namensräume
Varianten

std::basic_istream::read

Aus cppreference.com
< cpp‎ | io‎ | basic istream

 
 
Input / Output-Bibliothek
I / O-Manipulatoren
C-style I / O
Puffern
Original:
Buffers
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_streambuf
basic_filebuf
basic_stringbuf
strstreambuf(veraltet)
Streams
Original:
Streams
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Abstraktionen
Original:
Abstractions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
ios_base
basic_ios
basic_istream
basic_ostream
basic_iostream
Datei-I / O
Original:
File I/O
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_ifstream
basic_ofstream
basic_fstream
String I / O
Original:
String I/O
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_istringstream
basic_ostringstream
basic_stringstream
Array I / O
Original:
Array I/O
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
istrstream(veraltet)
ostrstream(veraltet)
strstream(veraltet)
Types
Original:
Types
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
streamoff
streamsize
fpos
Fehler Kategorie Schnittstelle
Original:
Error category interface
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
iostream_category(C++11)
io_errc(C++11)
 
std::basic_istream
Globale Objekte
Original:
Global objects
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
cin
wcin
Member-Funktionen
Original:
Member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_istream::basic_istream
basic_istream::~basic_istream
basic_istream::operator=(C++11)
Formatierte Eingabe
Original:
Formatted input
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_istream::operator>>
Unformatierte Eingabe
Original:
Unformatted input
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_istream::get
basic_istream::peek
basic_istream::unget
basic_istream::putback
basic_istream::getline
basic_istream::ignore
basic_istream::read
basic_istream::readsome
basic_istream::gcount
Positionierung
Original:
Positioning
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_istream::tellg
basic_istream::seekg
Verschiedenes
Original:
Miscellaneous
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_istream::sync
basic_istream::swap(C++11)
Mitglied Klassen
Original:
Member classes
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_istream::sentry
Non-Member-Funktionen
Original:
Non-member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
operator>>(std::basic_istream)
 
basic_istream& read( char_type* s, std::streamsize count );
Extrahiert Zeichen von stream .
Original:
Extracts characters from stream.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Verhält sich wie UnformattedInputFunction. Nach dem Bau und Prüfung der Schildwache Objekts, extrahiert Zeichen und speichert sie in aufeinander folgenden Aufenthaltsorten der Zeichen-Array, dessen erstes Element wird durch s hingewiesen. Zeichen werden extrahiert und gespeichert werden, bis eine der folgenden Bedingungen auftritt:
Original:
Behaves as UnformattedInputFunction. After constructing and checking the sentry object, extracts characters and stores them into successive locations of the character array whose first element is pointed to by s. Characters are extracted and stored until any of the following conditions occurs:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
  • count Zeichen wurden extrahiert und gespeichert
    Original:
    count characters were extracted and stored
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • Fileende Bedingung tritt auf der Eingabesequenz (in welchem ​​Fall setstate(failbit|eofbit) genannt .
    Original:
    end of file condition occurs on the input sequence (in which case, setstate(failbit|eofbit) is called.
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.

Inhaltsverzeichnis

[Bearbeiten]Parameter

s -
Zeiger auf den Zeichen-Array, um die Zeichen zu speichern
Original:
pointer to the character array to store the characters to
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
count -
Zahl der zu lesenden Zeichen
Original:
number of characters to read
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[Bearbeiten]Rückgabewert

*this

[Bearbeiten]Beispiel

read () wird oft für binäre verwendeten I / O
Original:
read() is often used for binary I/O
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

#include <iostream>#include <string>#include <sstream>#include <cstdint>int main(){std::string bin ={'\x12', '\x12', '\x12', '\x12'};std::istringstream raw(bin);std::uint32_t n; raw.read(reinterpret_cast<char*>(&n), 4);std::cout<<std::hex<<std::showbase<< n <<'\n';}

Output:

0x12121212

[Bearbeiten]Siehe auch

}
Einsätze Blöcken von Zeichen
Original:
inserts blocks of characters
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(öffentliche Elementfunktion of std::basic_ostream)[edit]
Extrakte formatierte Daten
Original:
extracts formatted data
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(öffentliche Elementfunktion)[edit]
extrahiert bereits verfügbaren Blöcke von Zeichen
Original:
extracts already available blocks of characters
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(öffentliche Elementfunktion)[edit]
Extrahiere Zeichen
(öffentliche Elementfunktion)[edit]
Extrakte Zeichen, bis die gegebene Zeichen gefunden wird
Original:
extracts characters until the given character is found
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(öffentliche Elementfunktion)[edit]
liest aus einer Datei
Original:
reads from a file
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(Funktion)[edit]
close