5

I have attended many online coding competition, they usually mention the note that #include<conio.h> means conio.h header can not be used. I am not aware about all functions included by this header but curios to know that why it's not a good programming habit? If anybody can explains some of it's functions should not be used.

example clrscr().

user
  • 130
  • 9

2 Answers2

7

Well, conio.h is platform-specific. If you try to compile on Linux, your code will probably not compile. Also - using functions to manipulate the console window make your program less reusable than if you were using just standard input and output (you cannot redirect the stdin/stdout so easily).

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

3

It's not standard

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

Some compilers support it but they are platform depended and it's hard to write a portable code between them.

masoud
  • 55,379
  • 16
  • 141
  • 208