专注收集记录技术开发学习笔记、技术难点、解决方案
网站信息搜索 >> 请输入关键词:
您当前的位置: 首页 > 汇编语言

GetDlgItemText API函数取得的字符最后一位是空字节?该如何处理

发布时间:2010-06-14 15:50:07 文章来源:www.iduyao.cn 采编人员:星星草
GetDlgItemText API函数取得的字符最后一位是空字节?
为什么GetDlgItemText API函数取得的字符最后一位是空字节,这样定义定义变量长度的时候就必须比实际输入的字符长度要多一位是不是。

------解决方案--------------------
lpString
[out] Pointer to the buffer to receive the title or text. 
nMaxCount
[in] Specifies the maximum length, in TCHARs, of the string to be copied to the buffer pointed to by lpString. If the length of the string, including the NULL character, exceeds the limit, the string is truncated. 



If the string is as long or longer than the buffer, the buffer will contain the truncated string with a terminating NULL character.


c风格的字符串是以'\0'结尾的,所以假如字符串长度是10字节,实际上是11字节,最后有个'\0'
友情提示:
信息收集于互联网,如果您发现错误或造成侵权,请及时通知本站更正或删除,具体联系方式见页面底部联系我们,谢谢。

其他相似内容:

热门推荐: