Share via


char_traits::eof

Devuelve el carácter final de (EOF) archivo.

static int_type eof();

Valor devuelto

El carácter EOF.

Comentarios

Un valor que representa el final del archivo (como EOF o WEOF).

Los estados estándar de C++ que este valor no debe corresponder a char_type un valor válido.El compilador de Visual C++ aplica esta restricción para chartipo, pero no para wchar_tescrito.El ejemplo siguiente muestra cómo hacerlo.

Ejemplo

// char_traits_eof.cpp
// compile with: /EHsc
#include <string>
#include <iostream>

int main()
{
    using namespace std;

    char_traits<char>::char_type ch1 = 'x';
    char_traits<char>::int_type int1;
    int1 = char_traits<char>::to_int_type(ch1);
    cout << "char_type ch1 is '" << ch1 << "' and corresponds to int_type "
         << int1 << "." << endl << endl;

    char_traits<char>::int_type int2 = char_traits<char>::eof();
    cout << "The eof marker for char_traits<char> is: " << int2 << endl;

    char_traits<wchar_t>::int_type int3 = char_traits<wchar_t>::eof();
    cout << "The eof marker for char_traits<wchar_t> is: " << int3 << endl;
}
  
  

Requisitos

encabezado: <cadena>

espacio de nombres: std

Vea también

Referencia

char_traits Struct