将CString转换为short [英] Convert CString to short

查看:648
本文介绍了将CString转换为short的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨...我想问一下,如何将CString数据转换为short(不是unsigned short).
我使用MFC. thx

Hi... I want to ask, how to convert CString data to short(not unsigned short).
I use MFC. thx

推荐答案

您是说您有一个存储在字符串中的数字并想要获取其数字值?

如果是这样,请查看 strtol [ ^ ]和 atoi [
Do you mean you have a number stored in a string and want to get its numerical value?

If so, take a look at strtol[^] and atoi[^]. Just cast these down to a short (and check to make sure the number is between -32768 and 32767.


是的,我愿意.我想从组合框中获取值在Microsoft通讯中使用.

感谢您的帮助.
yes, I do. I want get value from the combo box to use in Microsoft communication.

Thank for your help.


这篇关于将CString转换为short的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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