Namensräume
Varianten
Aktionen

std::basic_istream::getline

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& getline( char_type* s, std::streamsize count );
(1)
basic_istream& getline( char_type* s, std::streamsize count, char_type delim );
(2)
1)
Auszüge Zeichen von stream, bis zum Ende der Zeile (entspricht getline(s, count, widen(’\n’)))
Original:
Extracts characters from stream until the end of line (equivalent to getline(s, count, widen(’\n’)))
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
2)
Auszüge Zeichen von stream bis zum angegebenen Trennzeichen .
Original:
Extracts characters from stream until the specified delimiter.
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 aus *this und lagerte sie in aufeinanderfolgenden Stellen des Arrays, deren erstes Element wird durch s hingewiesen, bis eine der folgenden Situationen eintritt: (getestet in der angegebenen Reihenfolge)
Original:
Behaves as UnformattedInputFunction. After constructing and checking the sentry object, extracts characters from *this and stored them in successive locations of the array whose first element is pointed to by s until any of the following occurs: (tested in the order shown)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
  • Ende der Datei auftritt in der Eingabesequenz (in welchem ​​Fall setstate(eofbit) ausgeführt wird)
    Original:
    end of file condition occurs in the input sequence (in which case setstate(eofbit) is executed)
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • die nächste verfügbare Zeichen c ist das Trennzeichen, wie Traits::eq(c, delim) bestimmt. Der Begrenzer wird extrahiert (anders basic_istream::get()) und gezählt Richtung gcount(), aber nicht gespeichert .
    Original:
    the next available character c is the delimiter, as determined by Traits::eq(c, delim). The delimiter is extracted (unlike basic_istream::get()) and counted towards gcount(), but is not stored.
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • count-1 Zeichen extrahiert worden sind (in diesem Fall ausgeführt wird setstate(failbit)) .
    Original:
    count-1 characters have been extracted (in which case setstate(failbit) is executed).
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
Wenn die Funktion extrahiert keine Zeichen (zB wenn count < 1), setstate(failbit) ausgeführt wird .
Original:
If the function extracts no characters (e.g. if count < 1), setstate(failbit) is executed.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
In jedem Fall, wenn count>0 es speichert dann ein Nullzeichen CharT() in den nächsten nachfolgenden Standort des Arrays und Updates gcount() .
Original:
In any case, if count>0, it then stores a null character CharT() into the next successive location of the array and updates gcount().
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Inhaltsverzeichnis

[Bearbeiten] Notes

Weil Bedingung Nr. 2 wird getestet, bevor Bedingung # 3, der Eingang Linie, die genau der Puffer, gegen keine failbit .
Original:
Because condition #2 is tested before condition #3, the input line that exactly fits the buffer, does not trigger failbit.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Da die abschließende Zeichen als extrahierte Zeichen gezählt wird, kommt leere Eingabezeile nicht auslösen failbit .
Original:
Because the terminating character is counted as extracted character, empty input line does not trigger failbit.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[Bearbeiten] Parameter

s -
Zeiger auf die Zeichenkette, um die Zeichen zu speichern
Original:
pointer to the character string 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 -
Größe der Zeichenfolge, auf die s
Original:
size of character string pointed to by s
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
delim -
Trennzeichen, um die Extraktion bei stoppen. Es wird extrahiert, aber nicht gespeichert .
Original:
delimiting character to stop the extraction at. It is extracted but not stored.
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

#include <iostream>
#include <sstream>
#include <vector>
#include <array>
 
int main()
{
    std::istringstream input("abc|def|gh");
    std::vector<std::array<char, 4>> v;
 
    for(std::array<char, 4> a; input.getline(&a[0], 4, '|'); ) {
        v.push_back(a);
    }
 
    for(auto& a : v) {
        std::cout << &a[0] << '\n';
    }
}

Output:

abc
def
gh

[Bearbeiten] Siehe auch

Lesedaten von einem I / O-Strom in einen String
Original:
read data from an I/O stream into a string
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(Funktion)
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]
Extrakte Zeichen
Original:
extracts 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]
extrahiert Blöcken von Zeichen
Original:
extracts 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]