我在.mm文件中使用了strnlen的代码

使用Xcode 4.2的编译器可以很好地进行构建。
Xcode 3.2.5但是找不到strnlen()...

我已经尝试过为strlen发布的解决方案

#include <cstring> // doesn't work
using std::strlen; // doesn't work

#include <string> // doesn't work


有没有办法在iOS 4.2.1上使用strnlen?

现在,我只是转换为NSString对象并使用长度。

最佳答案

使用标准的C函数strlen是否有问题?我抬起头,看起来好像是GNU扩展。

07-26 00:54