Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

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

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().

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...