Why is the use of "conio.h" not a good programming habit?

I have participated in many online coding contests, they usually mention a note that #include<conio.h> means conio.h header cannot be used. I don’t know about all the features included in this header, but it’s interesting to know why this is not a good programming habit? If anyone can explain some of his functions, should not be used.

Example clrscr ().

+6
source share
2 answers

Well, conio.h is platform dependent. If you try to compile Linux, your code probably will not compile. In addition, using functions to control the console window makes your program less repetitive than if you used only standard input and output (you cannot redirect stdin / stdout so easily).

If you are creating rich console applications, you can use cross-platform libraries such as ncurses .

+8
source

This is not standard.

[...] it is not part of the C standard library, ISO C and is not defined by POSIX. 1

Some compilers support it, but are platform dependent, and it is difficult to write portable code between them.

+3
source

Source: https://habr.com/ru/post/957900/


All Articles