Compartilhar via


char_traits::eof

Retorna o caractere de final de Arquivo (EOF).

static int_type eof();

Valor de retorno

O caractere de EOF.

Comentários

Um valor que representa a fim do arquivo (como EOF ou WEOF).

Os estados padrão C++ que esse valor não deve corresponder a um valor válido de char_type .O compilador do Visual C++ garante essa restrição para o tipo char, mas não para o tipo wchar_t.O exemplo a seguir demonstra isso.

Exemplo

// 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

Cabeçalho: <string>

namespace: STD

Consulte também

Referência

char_traits Struct