请帮忙。这是什么意思? [英] please help. what it means?

查看:82
本文介绍了请帮忙。这是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

c1=(char)_getch();

推荐答案

请看我对这个问题的评论,这个问题效率不高。



这是C风格的类型转换,(char),对函数 _getch()返回的值执行。根据 _getch()的配置文件,它可能或没有意义。 char类型是ANSI(非Unicode)8位字符,主要是过时的。这个函数很可能就是这个函数,如果你需要 char ,需要进行类型转换:

https://msdn.microsoft.com/en-us/library/078sfkak.aspx [ ^ ],

另见:http://stackoverflow.com/questions/814975/getch-is-deprecated [ ^ ]。



这都是旧事。一种不需要这种丑陋类型转换的C ++方法是使用 cin cout stream: http://www.cplusplus.com/doc/tutorial/basic_io [ ^ ]。



我认为它有自己的丑陋和我记得我们的一位声誉很高的成员声称他讨厌它;我会理解,但从控制台读取的类型转换更糟糕。



-SA
Please see my comment to the question, which is not quite productive.

This is C-style typecast, (char), performed over the value returned by the function _getch(). Depending on the profile of _getch(), it may or make not make sense. The type char is ANSI (non-Unicode) 8-bit character, something which is majorly obsolete. This function, most likely, might be this one, which would require typecast if you need char:
https://msdn.microsoft.com/en-us/library/078sfkak.aspx[^],
see also: http://stackoverflow.com/questions/814975/getch-is-deprecated[^].

This is all old stuff. One C++ way which would not require this ugly type casting is using cin and cout streams: http://www.cplusplus.com/doc/tutorial/basic_io[^].

I think it has its own ugliness and I remember that one of our high-reputation members claimed he hates it; which I would understand, but typecasting for reading from console is worse.

—SA


这篇关于请帮忙。这是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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