Mail Archives: djgpp/2000/01/20/03:15:51
On Wed, 19 Jan 2000, Wormy wrote:
> textstring[0] = 0x50;
> textstring[1] = 0xFF;
> textstring[2] = 0x33;
> textstring[3] = 0x50;
> textstring[4] = 0x56;
> textstring[5] = 0x80;
>
> It's simple to get ONE BYTE when doing a printf ("%d\n",textstring[0]);
>
> But is there a way to get a long representation of the first 4 Bytes - with
> a pointer cast or so...
> like I would do with a
> char *memory
> and do something like (long *)memory or (short *)memory...
>
> What I would like is to get - thanks to a cast - the value 0x50FF3350
Use htonl(*(long *)textstring). `htonl' is a library function
declared in the header <netinet/in.h>.
- Raw text -