本文介绍了strlen()给出数组中空字节的错误大小原因的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个从流中反序列化的动态char数组.
I have a dynamic char array that was deserialized from a stream.
文件上的 char * myarray
的内容(使用hexal编辑器):
Content of char *myarray
on the file (with a hexal editor) :
4F 4B 20 31 32 20 0D 0A 00 00 B4 7F
strlen(myarray)
返回8,(必须为12)
strlen(myarray)
returns 8, (must be 12)
推荐答案
strlen(myarray)
返回 myarray
00 的索引>.
strlen(myarray)
returns the index of the first 00
in myarray
.
这篇关于strlen()给出数组中空字节的错误大小原因的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!