🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.programmer
Article #3441

Re: Displaying addresses of variables in hex?

#3441
From: Ronald Fischer
Date: Mon, 18 Nov 1996 00:00
20 lines
1230 bytes
Borg wrote:
> 
> Hi,
> 
> A quick (dumb?) question:
> 
> How do I display variable addresses in hex rather than in decimal?

To output the address, cast the pointer to void* (because some other pointer
types, such as char*, get special treatment). To get the output in hex,
use the hex inserter:
	ostr << hex << (void const*)&variable;

-- 

Ronald Otto Valentin Fischer
business: ronald.fischer@uebemc.siemens.de
private:  ronald.fischer@acm.org
http://ourworld.compuserve.com/homepages/ronald_fischer
Technical Details
Message-ID: <32906978.42C9@uebemc.siemens.de>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <56m5ch$noi@news.iceonline.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fc89c,7ec25c815d4734dc
X-Google-Attributes: gidfc89c,public
X-Google-Thread: 10ba33,7ec25c815d4734dc
X-Google-Attributes: gid10ba33,public
From: Ronald Fischer <ronald.fischer@uebemc.siemens.de>
Subject: Re: Displaying addresses of variables in hex?
Date: 1996/11/18
Message-ID: <32906978.42C9@uebemc.siemens.de>
X-Deja-AN: 197216648
references: <56m5ch$noi@news.iceonline.com>
to: Borg <vladimip@iceonline.com*>
content-type: text/plain; charset=us-ascii
organization: Siemens AG,(Hofmannstr)  Munich-Germany-Europe.
mime-version: 1.0
newsgroups: comp.unix.programmer,gnu.g++.help
x-mailer: Mozilla 2.01 (X11; I; SunOS 5.4 sun4m)