Unformatted console I/O functions.

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.

Related Links :

No comments:

Post a Comment


If you face any Problem in viewing code such as Incomplete "For Loops" or "Incorrect greater than or smaller" than equal to signs then please collect from My Web Site CLICK HERE


More Useful Topics...

 

History Of C..

In the beginning was Charles Babbage and his Analytical Engine, a machine
he built in 1822 that could be programmed to carry out different computations.
Move forward more than 100 years, where the U.S. government in
1942 used concepts from Babbage’s engine to create the ENIAC, the first
modern computer.
Meanwhile, over at the AT&T Bell Labs, in 1972 Dennis Ritchie was working
with two languages: B (for Bell) and BCPL (Basic Combined Programming
Language). Inspired by Pascal, Mr. Ritchie developed the C programming
language.

My 1st Program...


#include
#include
void main ()
{
clrscr ();
printf ("\n\n\n\n");
printf ("\t\t\t*******Pankaj *******\n");
printf ("\t\t\t********************************\n");
printf ("\t\t\t\"Life is Good...\"\n");
printf ("\t\t\t********************************");
getch ();
}

Next Step...


#include
#include

void main ()
{
clrscr ();
printf ("\n\n\n\n\n\n\n\n");
printf ("\t\t\t --------------------------- \n\n");

printf ("\t\t\t | IGCT, Info Computers, INDIA | \n\n");
printf ("\t\t\t --------------------------- ");

getch ();

}

Hits!!!