Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Convert integer to string
Message
De
13/10/2005 02:11:09
 
 
À
12/10/2005 21:32:04
Information générale
Forum:
Visual C++
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01058521
Message ID:
01058561
Vues:
15
>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform