|
Cet article a fait l'objet d'une traduction automatique. Déplacez votre pointeur sur les phrases de l'article pour voir la version originale de ce texte. Informations supplémentaires.
|
Traduction
Source
|
ungetc, ungetwc
int ungetc( int c, FILE *stream ); wint_t ungetwc( wint_t c, FILE *stream );
|
|
|
|
|
|---|---|---|---|
|
_ungettc |
ungetc |
ungetc |
ungetwc |
|
|
|
|---|---|
|
ungetc |
|
|
ungetwc |
|
// crt_ungetc.c
// This program first converts a character
// representation of an unsigned integer to an integer. If
// the program encounters a character that is not a digit,
// the program uses ungetc to replace it in the stream.
//
#include <stdio.h>
#include <ctype.h>
int main( void )
{
int ch;
int result = 0;
// Read in and convert number:
while( ((ch = getchar()) != EOF) && isdigit( ch ) )
result = result * 10 + ch - '0'; // Use digit.
if( ch != EOF )
ungetc( ch, stdin ); // Put nondigit back.
printf( "Number = %d\nNext character in stream = '%c'",
result, getchar() );
}
nombre d'521a= 521 caractère suivant dans le flux = « a » Non applicable. Pour appeler la fonction C standard, utilisez PInvoke. Pour plus d'informations, consultez l' Exemples d'appel de code non managé.