How can I convert from UInt to CString and back and LPTSTR to CString and back?
How can I convert from UInt to CString and back and LPTSTR to CString and back?
the best things in life are simple.
nm i think i got it. Though I get an error when I try to use CString:
I have windows.h and string.g included.Code:error C2065: 'CString' : undeclared identifier error C2146: syntax error : missing ';' before identifier 'str' error C2065: 'str' : undeclared identifier
Last edited by xlnk; 08-24-2003 at 04:01 PM.
the best things in life are simple.
from UINT to CString:
CString str;
str.Format("%i", 123);
Is it even possible to use CString in straight win32 API or is it MFC specific?
the best things in life are simple.
Is there an alternative I can use?
I could use <string> but how can I convert from UINT to string and back?
the best things in life are simple.
The STL has a the sstream header.
That doesn't have anything to so with MFC however this code should be useful.Code:#include <iostream> #include <sstream> int main(void) { using namespace std; istringstream from; ostringstream to; int i; to << 15; cout << to.str() << endl; from = to.str(); from >> i; cout << i << endl; return 0; }