C++里取长度用什么?

来源:百度知道 编辑:UC知道 时间:2024/06/02 01:19:24
是GetLength( )吗 大小写有错误吗? 头文件是#include <string.h>吗?

#include <string.h>
strlen()

使用char* 字符串使用strlen(),需包含<string.h>
使用string类的话使用size(),也需包含<string.h>

你说的那个必须#include "afx.h"并且在工程设置里把MFC设置为共享DLL
其他的:sizeof()取整个结构的大小
#include "string.h"后,strlen()可以取字符串长度,长度不包括NUL终止符。