|
|
@ -3,8 +3,9 @@ |
|
|
|
#include "c.h" |
|
|
|
#include "c.h" |
|
|
|
|
|
|
|
|
|
|
|
static char* CopyString(const std::string& str) { |
|
|
|
static char* CopyString(const std::string& str) { |
|
|
|
char* result = reinterpret_cast<char*>(malloc(sizeof(char) * str.size())); |
|
|
|
char* result = reinterpret_cast<char*>(malloc(sizeof(char) * str.size()+1)); |
|
|
|
memcpy(result, str.data(), sizeof(char) * str.size()); |
|
|
|
memcpy(result, str.data(), sizeof(char) * str.size()); |
|
|
|
|
|
|
|
result[sizeof(char) * str.size()] = 0; |
|
|
|
return result; |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|