Condividi tramite


basic_streambuf::sgetc

Restituisce l'elemento corrente senza modificare la posizione nel flusso.

int_type sgetc( );

Valore restituito

L'elemento corrente.

Note

Se una posizione lettura è disponibile, la funzione membro restituisce traits_type::to_int_type(*gptr). In caso contrario, restituisce underflow.

Esempio

// basic_streambuf_sgetc.cpp
// compile with: /EHsc
#include <iostream>
#include <fstream>

int main( ) 
{
   using namespace std;
   ifstream myfile( "basic_streambuf_sgetc.txt", ios::in );

   char i = myfile.rdbuf( )->sgetc( );
   cout << i << endl;
   i = myfile.rdbuf( )->sgetc( );
   cout << i << endl;
}

Input: basic_streambuf_sgetc.txt

testing

Output

t
t

Requisiti

streambuf <diIntestazione: >

Spazio dei nomi: std

Vedere anche

Riferimenti

Classe basic_streambuf

Programmazione di iostream

Convenzioni di iostream