Afficher un message
Vieux 09/04/2008, 08h19   #2
Michael DOUBEZ
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Probleme avec istringstream

Guillaume GOURDIN a écrit :
> Bonjour à tous, j'ai un problème avec le code suivant :
>
> #include <sstream>
> #include <iostream>
> #include <stdint.h>
> using namespace std;
>
> int main(int argc, char ** argv)
> {
> string s("endor ID Low Byte");
> istringstream iss;
> uint32_t tmp;
>
> iss.str( s );
>
> if ( !(iss >> hex >> tmp) )
> {
> return ( false );
> }
>
> cout << tmp << endl;
>
> return ( true );
> }
>
> Pour ce code, "endor ID Low Byte" est une représentation hexadécimal de
> 14... Quelqu'un peut-il me dire ce que je fais pas bien?


La stream lit le premier "e" qui a la valeur 14 en hexadecimal.

Michael
  Réponse avec citation
 
Page generated in 0,04469 seconds with 9 queries