_ungetch, _ungetwch, _ungetch_nolock, _ungetwch_nolock
Konsoldan okumak son karakter geri iter.
Önemli |
---|
Bu API, Windows çalışma zamanı yürütme uygulamalarda kullanılamaz.Daha fazla bilgi için bkz: /zw ile desteklenmeyen crt işlevlerinin. |
int _ungetch(
int c
);
wint_t _ungetwch(
wint_t c
);
int _ungetch_nolock(
int c
);
wint_t _ungetwch_nolock(
wint_t c
);
Parametreler
- c
Karakteri itilmiş olabilir.
Dönüş Değeri
Her iki işlevi dönüş karakteri c başarılı olursa.If there is an error, _ungetch returns a value of EOF and _ungetwchreturnsWEOF.
Notlar
Bu işlevler itme karakter c konsola yeniden neden c tarafından okunan bir sonraki karakteri olarak _getch veya _getche (veya _getwch veya_getwche)._ungetchve _ungetwch önce sonraki okuma adlı birden çok kez başarısız.The c argument may not be EOF (or WEOF).
Sürümleri ile _nolock sonek dışında başka iş parçaları tarafından girişime korunmaz özdeş.Diğer iş parçacığı kilitleme yükünü tabi olmayan bu yana daha hızlı olabilir.Bu işlevler yalnızca iş parçacığı açısından güvenli içerikleri tek iş parçacıklı uygulamalar ya da burada iş parçacığı ayırma arama kapsamı zaten işler gibi kullanın.
Genel metin eşlemeleri yordamına girildi
TCHAR.H yordamına girildi |
_UNICODE & _mbcs tanımlanmamış |
Tanımlanan _mbcs |
Tanımlanan _UNICODE |
---|---|---|---|
_ungettch |
_ungetch |
_ungetch |
_ungetwch |
_ungettch_nolock |
_ungetch_nolock |
_ungetch_nolock |
_ungetwch_nolock |
Gereksinimler
Yordamı |
Gerekli başlık |
---|---|
_ungetch, _ungetch_nolock |
<conio.h> |
_ungetwch, _ungetwch_nolock |
<conio.h> veya <wchar.h> |
Ek uyumluluk bilgileri için bkz: Uyumluluk giriş.
Örnek
// crt_ungetch.c
// compile with: /c
// In this program, a white-space delimited
// token is read from the keyboard. When the program
// encounters a delimiter, it uses _ungetch to replace
// the character in the keyboard buffer.
//
#include <conio.h>
#include <ctype.h>
#include <stdio.h>
int main( void )
{
char buffer[100];
int count = 0;
int ch;
ch = _getche();
while( isspace( ch ) ) // Skip preceding white space.
ch = _getche();
while( count < 99 ) // Gather token.
{
if( isspace( ch ) ) // End of token.
break;
buffer[count++] = (char)ch;
ch = _getche();
}
_ungetch( ch ); // Put back delimiter.
buffer[count] = '\0'; // Null terminate the token.
printf( "\ntoken = %s\n", buffer );
}
Ayrıca bkz.
Başvuru
Konsol ve bağlantı noktası g/Ç