The functions under this category are :
getch() putch() gets()
getche() putchar() puts()
getchar() fputchar()
fgetchar()
These above listed function broadly fall into two categories, the one which deal with a single character and the second which deal with a string of characters.
Explanations :
getch() : This function will read a single character the instant it is typed by programmer without waiting for the Enter Key to be hit. The typed character is not echoed on screen.
getche() : This function will also read a single character the instant it is typed by programmer without waiting for the Enter key to be hit, just like getch() function. The additional character 'e' in function getch() echoes the character on screen that you typed. This is a point of differences between getch() & getche().
getchar() : It works similar to that of getch() and also echoes the character you typed on the screen but it also requires enter key to be hit immediately after the character that you typed. It is a macro.
fgetchar() : It will echo the character on screen and it requires hit of Enter key immediately following the character. The only difference between getchar() and fgetchar() is that the former is a macro and latter is function.
putch() : It writes a character to the screen.
putchar() : It writes a character to the screen and is a macro.
fputchar() : It writes a character to the screen (function version).
(Note : putch(), putchar() and fputchar() can output only one character at a time on screen.)
gets() : It gets a string from the keyboard and it is necessary on programmers part to terminates that string with an Enter key. That's why spaces and tabs are acceptable as a part of the input string if any gets() is used to read only one string at a time.
puts() : It outputs a string to the screen puts() can outputs only one string at a time.
getch() putch() gets()
getche() putchar() puts()
getchar() fputchar()
fgetchar()
These above listed function broadly fall into two categories, the one which deal with a single character and the second which deal with a string of characters.
Explanations :
getch() : This function will read a single character the instant it is typed by programmer without waiting for the Enter Key to be hit. The typed character is not echoed on screen.
getche() : This function will also read a single character the instant it is typed by programmer without waiting for the Enter key to be hit, just like getch() function. The additional character 'e' in function getch() echoes the character on screen that you typed. This is a point of differences between getch() & getche().
getchar() : It works similar to that of getch() and also echoes the character you typed on the screen but it also requires enter key to be hit immediately after the character that you typed. It is a macro.
fgetchar() : It will echo the character on screen and it requires hit of Enter key immediately following the character. The only difference between getchar() and fgetchar() is that the former is a macro and latter is function.
putch() : It writes a character to the screen.
putchar() : It writes a character to the screen and is a macro.
fputchar() : It writes a character to the screen (function version).
(Note : putch(), putchar() and fputchar() can output only one character at a time on screen.)
gets() : It gets a string from the keyboard and it is necessary on programmers part to terminates that string with an Enter key. That's why spaces and tabs are acceptable as a part of the input string if any gets() is used to read only one string at a time.
puts() : It outputs a string to the screen puts() can outputs only one string at a time.
No comments:
Post a Comment