delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/01/19/18:05:16

From: "Wormy" <wormy AT technologist DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Casting pointers
Date: Wed, 19 Jan 2000 22:30:33 +0100
Organization: University of Economics and Business Administration, Vienna, Austria
Lines: 37
Message-ID: <865adi$tbm$1@bird.wu-wien.ac.at>
NNTP-Posting-Host: 212186012098.11.wu-wien.teleweb.at
X-Trace: bird.wu-wien.ac.at 948317426 30070 212.186.12.98 (19 Jan 2000 21:30:26 GMT)
X-Complaints-To: news-admin AT wu-wien DOT ac DOT at
NNTP-Posting-Date: 19 Jan 2000 21:30:26 GMT
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2314.1300
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

HI!

I would be glad if someone could help me...

char textstring[6];

let's say
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
Is that possible with a cast or do I really have to do something like

longvalue = textstring[0]<<24 || textstring[1]<<16 || textstring[2]<<8 ||
textstring[3]

to get it???

Thanx in advance?

Wormy




- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019