Pages

Of Computers, troubles and my Experiments with programming as a beginner.

Wednesday, March 26, 2008

conio.h Header

Conio.h is yet another header file. It is however, not a part of the C standard library and does not find place among the 24 ANSI C library headers. It is mainly used for console input,output. The Dev C++ compiler does not have this header by default and it has to be separately downloaded if required. It is not very popular actually.
Some of it's important member functions are kbhit, ungetch, getch, getche, putch and some more.
I primarily use getch function for the output to display on the console. It's actually the easiest way. Otherwise, what happens is the console window closes immediately after the output is displayed. In a program where a few inputs are required from the user, this might not be of immediate concern. However, even then you will not be able to visualise the final output. There are other ways of doing the same. We shall cover that later.
So the console now waits for you to press a key on your keyboard. Till then, you can sit and marvel at the output of your program. :)

No comments: