Frustrated with conversion
-
Hi, I'm pulling my hair out trying to do something simple. Thanks to the complicated and cryptic function signatures of MS with all that _in _out stuff I can't figure out how to do the following: int pageNumber = 1; int numPages = 2; wstring wstr2Display; // I want to make this: L"1/2" wstr2Display = ToString(pageNumber) + L"/" + ToString(numPages); Seems I also can't directly 'add' the L"/". Can someone share with me how to do this? Thanks
-
Hi, I'm pulling my hair out trying to do something simple. Thanks to the complicated and cryptic function signatures of MS with all that _in _out stuff I can't figure out how to do the following: int pageNumber = 1; int numPages = 2; wstring wstr2Display; // I want to make this: L"1/2" wstr2Display = ToString(pageNumber) + L"/" + ToString(numPages); Seems I also can't directly 'add' the L"/". Can someone share with me how to do this? Thanks
erm... I'm not sure where Microsoft comes into this ? Is this mananged C++, or is ToString your own function ? What is ToString returning ?
Christian Graus - C++ MVP
-
erm... I'm not sure where Microsoft comes into this ? Is this mananged C++, or is ToString your own function ? What is ToString returning ?
Christian Graus - C++ MVP
MS only came into it because I can't read the cryptic help with all the extra stuff in the function signatures. ToString() is just a 'dummy' function to allow me to write the line to show what I'm trying to do. Actually, turns out what I really need is just to be able to concatenate and int + WCHAR + int into a WCHAR*. Then I can use that WCHAR* to call GdiPlus::Drawstring() So, in short, how do I convert an int to a WCHAR* representation?
-
MS only came into it because I can't read the cryptic help with all the extra stuff in the function signatures. ToString() is just a 'dummy' function to allow me to write the line to show what I'm trying to do. Actually, turns out what I really need is just to be able to concatenate and int + WCHAR + int into a WCHAR*. Then I can use that WCHAR* to call GdiPlus::Drawstring() So, in short, how do I convert an int to a WCHAR* representation?
-
MS only came into it because I can't read the cryptic help with all the extra stuff in the function signatures. ToString() is just a 'dummy' function to allow me to write the line to show what I'm trying to do. Actually, turns out what I really need is just to be able to concatenate and int + WCHAR + int into a WCHAR*. Then I can use that WCHAR* to call GdiPlus::Drawstring() So, in short, how do I convert an int to a WCHAR* representation?
Like PJ said, your core problem is that you can add a wchar * to a wstring, you can't add three wchar* to each other. Your best bet IMO is an ostringstream, but itoa will do just fine ( well,itow if such a thing exists, or itot, perhaps ?)
Christian Graus - C++ MVP
-
Hi, I'm pulling my hair out trying to do something simple. Thanks to the complicated and cryptic function signatures of MS with all that _in _out stuff I can't figure out how to do the following: int pageNumber = 1; int numPages = 2; wstring wstr2Display; // I want to make this: L"1/2" wstr2Display = ToString(pageNumber) + L"/" + ToString(numPages); Seems I also can't directly 'add' the L"/". Can someone share with me how to do this? Thanks
wstr2Display = ToString(pageNumber) + wstrin(L"/") + ToString(numPages); try this!! -- Reddy
-
wstr2Display = ToString(pageNumber) + wstrin(L"/") + ToString(numPages); try this!! -- Reddy
That would work if you put a g on the end of wstring :-) And if ToString returns a wstring as well.
Christian Graus - C++ MVP
-
wstr2Display = ToString(pageNumber) + wstrin(L"/") + ToString(numPages); try this!! -- Reddy