How to convert an unmanaged double to a managed string?

From managed C ++, I call the unmanaged C ++ method, which returns double. How to convert this double to a managed string?

+3
source share
2 answers

I guess something like

(gcnew System::Double(d))->ToString()
+7
source

C ++ is certainly not the strongest skill set. Do not pay attention to the question, but this should convert to std :: string, not what you are looking for, but leaving it as it was the original post ....

double d = 123.45;
std::ostringstream oss;
oss << d;
std::string s = oss.str();

This needs to be converted to a managed string.

double d = 123.45
String^ s = System::Convert::ToString(d);
+2
source

Source: https://habr.com/ru/post/1697219/


All Articles