如何获取程序中特定字符串占用的字节数? [英] How to get the number of bytes occupied by a specific string in the program?

查看:130
本文介绍了如何获取程序中特定字符串占用的字节数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Im使用BSPlib,我想使用bsp_put,它要求我设置我发送的字符串的大小。
即使你不熟悉BSP,这也不是密切相关。感谢。

Im using BSPlib and I want to use the bsp_put which requires me to set the size of the string I'm sending. Even if you aren't familiar with BSP, this is not closely related. thanks.

推荐答案

strlen 返回纯C字符串的字符串长度。

strlen returns the length of string of a plain C string.


AC字符串与字符串开头和终止空字符之间的字符数量一样长。

A C string is as long as the amount of characters between the beginning of the string and the terminating null character.

如果你使用String对象,你可以使用 length

If you're using the String object you can use the length or size method of the object:

http://www.cplusplus.com/reference/string/string/length/

这篇关于如何获取程序中特定字符串占用的字节数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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