Get the next character from stdin.
This function is compatible with the following targets:
|
|
#include <stdio.h>
int getchar(void);Parameters: Remarks:
The getchar() function reads a character from the stdin stream.
NOTE
Getchar() is implemented as getc(stdin) and as such getchar's return may be delayed or optimized out of program order if stdin is buffered. For most implementations stdin is line buffered.
"Wide Character and Byte Character Stream Orientation"
Example of getchar() usage:#include <stdio.h>
int main(void)
{
int c;
printf("Enter characters to echo, * to quit.\n");
// characters entered from the console are echoed
// to it until a * character is read
while ( (c = getchar()) != '*')
putchar(c);
printf("\nDone!\n");
return 0;
}
Output:
Enter characters to echo, * to quit.
I'm experiencing deja-vu *
I'm experiencing deja-vu
Done!
[ First ] [ Previous ] [ Next ] [ Last ] [ Manuals ]
Visit the Metrowerks website at: http://www.metrowerks.com
For assistance contact Metrowerks Technical Support at: cw_support@metrowerks.com
Copyright © 2000, Metrowerks Corp. All rights reserved.
Last updated: August 16, 2000