Date: Thu, 20 Jan 2000 08:56:20 +0200 (IST) From: Eli Zaretskii X-Sender: eliz AT is To: Wormy cc: djgpp AT delorie DOT com Subject: Re: Casting pointers In-Reply-To: <865adi$tbm$1@bird.wu-wien.ac.at> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com Errors-To: dj-admin AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk 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 .