Closed error408 closed 4 years ago
It's not safe to call c_str
on a temporary. wks->cell(y, x).value<std::string>()
returns a string
which is destructed immediately afterwards so the pointer from c_str
points to invalid data when you try to use it. You'll need to store the string object somewhere or make a copy of its data on the stack or heap.
I want use xlnt in UE4, but when I get string cell value to FString, it's always crash. such as:
FString key = UTF8_TO_TCHAR(wks->cell(y, x).value<std::string>().c_str());
orFString key = wks->cell(index, KEY_LINE).value<std::string>().c_str();
emmmm。。。