为什么使用" CONIO.H"是不是编程的好习惯? [英] Why the use of "conio.h" is not good habit of programming?

查看:127
本文介绍了为什么使用" CONIO.H"是不是编程的好习惯?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我参加过很多的在线编码竞赛,他们通常提到的注意,#包括< CONIO.H> 办法 CONIO.H 报头不能被使用。
我不知道有关这个头,但古玩包括所有的功能要知道为什么这不是一个很好的的编程习惯?
如果有人能解释它的一些功能不应该被使用。


  

例如clrscr()。



解决方案

好了, CONIO.H 是特定于平台。如果你尝试编译在Linux上,你的code可能不会编译。此外 - 使用功能来操作控制台窗口使你的程序可重复使用较少比如果你只使用标准输入和输出(你不能重定向标准输入/输出那么容易)

如果您正在丰富的控制台应用程序,你可以改用跨平台库,如的ncurses

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

解决方案

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.

这篇关于为什么使用&QUOT; CONIO.H&QUOT;是不是编程的好习惯?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆