Condividi tramite


_getch_nolock, _getwch_nolock

Ottiene un carattere dalla console senza echo e senza bloccare la thread.

Importante

Questa API non può essere utilizzata nelle applicazioni che vengono eseguite in Windows Runtime.Per ulteriori informazioni, vedere Funzioni CRT non supportate con /ZW.

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

Valore restituito

Restituisce il carattere letto. Nessun ritorno di errore.

Note

_getch_nolock e _getwch_nolock sono identiche a _getch edi_getchw ad eccezione del fatto che non proteggono dalle interferenze da parte di altre thread. Potrebbero essere più veloci perché non comportano un sovraccarico che blocca altri thread. Utilizzare queste funzioni solo in contesti thread-safe come applicazioni a thread singolo o dove l'ambito chiamante già gestisce l'isolamento del thread.

Mapping di routine su testo generico

Routine Tchar.h

_UNICODE e _MBCS non definiti

_MBCS definito

_UNICODE definito

_gettch_nolock

_getch_nolock

_getch_nolock

_getwch_nolock

Requisiti

Routine

Intestazione obbligatoria

_getch_nolock

<conio.h>

_getwch_nolock

<conio.h> o <wchar.h>

Per ulteriori informazioni sulla compatibilità, vedere Compatibilità.

Esempio

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

Equivalente in NET Framework

Non applicabile. Per chiamare la funzione standard C, utilizzare PInvoke. Per ulteriori informazioni, vedere Esempi di Invocazione della Piattaforma.

Vedere anche

Riferimenti

I/O console e porta

_getche, _getwche

_cgets, _cgetws

getc, getwc

_ungetch, _ungetwch, _ungetch_nolock, _ungetwch_nolock