Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Convert integer to string
Message
From
13/10/2005 02:11:09
 
 
To
12/10/2005 21:32:04
General information
Forum:
Visual C++
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01058521
Message ID:
01058561
Views:
11
>Hi,
>How could I convert integer/long value to string?
>I tried to use (string)myInt and _ltow() but it return error
>
>error C2440: 'type cast' : cannot convert from 'long' to 'class std::basic_string (char),struct std::char_traits(char),class std::allocator(char)
>
>Pls advise.
>
>Thank you

I would not expect a cast to work here

Either use sprintf() or _ltoa()/_itoa()

For info and an example on _itoa see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt__itoa.2c_._i64toa.2c_._ui64toa.2c_._itow.2c_._i64tow.2c_._ui64tow.asp
Gregory
Previous
Reply
Map
View

Click here to load this message in the networking platform