diff --git a/cocos/platform/CCFileUtils.cpp b/cocos/platform/CCFileUtils.cpp index 98236dff79..1fdbb21d97 100644 --- a/cocos/platform/CCFileUtils.cpp +++ b/cocos/platform/CCFileUtils.cpp @@ -479,7 +479,7 @@ FileUtils::~FileUtils() bool FileUtils::writeStringToFile(const std::string& dataStr, const std::string& fullPath) const { - return FileUtils::writeBinaryToFile(dataStr.c_str(), dataStr.length(), fullPath); + return FileUtils::writeBinaryToFile(dataStr.c_str(), dataStr.size(), fullPath); } void FileUtils::writeStringToFile(std::string dataStr, const std::string& fullPath, std::function callback) const