_getch_nolock, _getwch_nolock

Obtém um caractere de um console sem eco e sem bloquear o thread.

int _getch_nolock( void );
wint_t _getwch_nolock( void );

Valor de retorno

Retorna o caractere de leitura.Não há nenhum retorno de erro.

Comentários

_getch_nolock and _getwch_nolock are identical to _getch and_getchw except that they not protected from interference by other threads.Talvez mais rápidos porque eles não aumentam a sobrecarga de bloqueio de outros segmentos.Utilizar essas funções em contextos de thread-safe, sistema autônomo aplicativos single-threaded ou onde o escopo de chamada já manipula o thread isolamento.

Mapeamentos de rotina de texto genérica

Rotina tchar.h

_UNICODE e _MBCS não definido

_MBCS definido

_UNICODE definido

_gettch_nolock

_getch_nolock

_getch_nolock

_getwch_nolock

Requisitos

Rotina

Cabeçalho necessário

_getch_nolock

<conio.h>

_getwch_nolock

<conio.h> ou <wchar.h>

Para obter mais informações de compatibilidade, consulte Compatibilidade na introdução.

Exemplo

// crt_getch_nolock.c
// compile with: /c
// This program reads characters from
// the keyboard until it receives a 'Y' or 'y'.
 

#include <conio.h>
#include <ctype.h>

int main( void )
{
   int ch;

   _cputs( "Type 'Y' when finished typing keys: " );
   do
   {
      ch = _getch_nolock();
      ch = toupper( ch );
   } while( ch != 'Y' );

   _putch_nolock( ch );
   _putch_nolock( '\r' );    // Carriage return
   _putch_nolock( '\n' );    // Line feed
}

abcdey

Type 'Y' when finished typing keys: Y

Equivalente .NET estrutura

Não aplicável.Para telefonar a função C padrão, use PInvoke. Para obter mais informações, consulte Exemplos de invocação de plataforma.

Consulte também

Referência

Console e porta de E/s

_getche, _getwche

_cgets, _cgetws

getc, getwc

_ungetch, _ungetwch, _ungetch_nolock, _ungetwch_nolock