Re: char array to long

Jan Hendrik Berlin <[email protected]>
Newsgroups gmane.linux.suse.programming
Message-ID <[email protected]>
> uint32_t v = 0;
> uint8_t b [4];
> v += b [0];
> v += b [1] * 256;
> v += b [2] * 65536;
> v += b [4] * 16777216;


Das gefällt mir! macht nur noch bissl ärger! 

Mein Quelltext:
# include <iostream.h>

int main()
 {
 uint32_t v = 0;
 uint8_t b [4];
 int i;

 for(i=0;i<4;i++)
 {
  b[i]=255;
 }

 v += b [0];
 v += b [1] * 256;
 v += b [2] * 65536;
 v += b [4] * 16777216;

 cout <<v;
}

Meine Fehlermeldungen:

test.cpp: In function `int main()':
test.cpp:5: error: `uint32_t' undeclared (first use this function)
test.cpp:5: error: (Each undeclared identifier is reported only once for each
   function it appears in.)
test.cpp:5: error: syntax error before `=' token
test.cpp:6: error: `uint8_t' undeclared (first use this function)
test.cpp:11: error: `b' undeclared (first use this function)
test.cpp:14: error: `v' undeclared (first use this function)

Ich denke, ich muss noch ne header einbinden oder? iostream reicht da wohl 
nicht! Was will der denn für uint haben?

Ich hoffe, ich strapaziere eure Nerven nicht allzusehr! Aber die Hilfe, die 
mir hier entgegengebracht wird, ist schon echt super! DANKE! Kannzwar 
bisschen was schreiben, aber alzzuhoch ist das niveau auf unserer schule da 
nicht! :)

mfg
Jan

-- 
Um die Liste abzubestellen, schicken Sie eine Mail an:
    [email protected]
Um eine Liste aller verfügbaren Kommandos zu bekommen, schicken
Sie eine Mail an: [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.