Use of The Conio.h Library
Use of The Conio.h Library
h Library
The conio.h library is not standard but is owned by Borland, and is included in
its compilers. It is a library for handling input and output of data in the console
for the DOS system. That it is not standard means that you will not find it implemented -o
at least totally - in many compilers, and more importantly, in other systems, what
reduces the portability of your code. On the other hand, the library is considered obsolete, and it is
It is possible that some of the included functions do not work or do so incorrectly.
But the most important thing is to realize that this library is not strictly necessary.
for programming. From experience, the most used functions of this library are, with
difference clear screen() gotoxy() y getch().
clrscr() clears the screen, something that is generally not necessary; if you are running a
The command line program is easy and quick to type a command (cls, clear) that clears
the screen in question if you need it. On the other hand, it may be annoying that a program
I took the initiative and cleared the screen, as it may have data that the user wants.
conserve.
That is to say, nothing happens if you don't clear the screen. Normally, the person using a
program of line of commands no wait what that happen.
gotoxy() moves the cursor to a specific position on the screen. This can be useful in
occasions, but let's be honest: it is not usually very necessary to move the cursor through the
screen, or at least not strictly necessary. For example, if you are learning to
program. If you program an advanced application, it is almost certain that you will have an interface.
Graph. As a last resort, if you are programming an advanced console application,
by now you probably already know how to do this function yourself using
system calls, which has the benefit that you can encapsulate that function in front
to portability, instead of relying on a system-dependent library function.
Getch() collects a character from standard input. For that, you have nearly thousands of
Standard functions that do it. Okay, maybe not that many, but you have at least one in C.
getchar() and another in C++ std::cin.get() Why use getch() which is NOT standard when
Can you use a standard function that does exactly the same?
Before you call me a liar, it must be acknowledged that getch() does not exactly do what
same as the other two functions. Getch() DOES NOT display the captured character by the
the screen and the input is without buffer (which means that it is not necessary to press enter) Without
embargo I don’t think that this is generally a serious problem, moreover, an entry without
buffer can even be a problem: you cannot correct the input if you make a mistake.