From: Thomas Demmer Newsgroups: comp.os.msdos.djgpp Subject: Re: Printing Pointer Address - cout (gxx version 2.7.2.1) Date: Thu, 16 Apr 1998 23:24:16 +0200 Organization: Lehrstuhl fuer Stroemungsmechanik Lines: 35 Message-ID: <35367700.58EFD99A@LSTM.Ruhr-UNI-Bochum.De> References: NNTP-Posting-Host: bvb.lstm.ruhr-uni-bochum.de Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit CC: Rick Umali To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Rick Umali wrote: [...] > Now I have figured out that replacing lines like this: > > 18 cout << "&pAge:\t" << &pAge << "\n"; > > with: > > 18 cout << "&pAge:\t" << (int) &pAge << "\n"; > > causes the printing of what looks to be an address, but > I'm curious why my pointers don't print. Why do I have to do > a cast to get the address? > > (I didn't down load source to find this answer for myself.) Because you stumbled over a long lasting bug in libiostream. Prepend a << hex << to the cast to get something that really looks like a pointer. AFAIK, Robert is working on a newer version. -- Ciao Tom ************************************************************* * Thomas Demmer * * Lehrstuhl fuer Stroemungsmechanik * * Ruhr-Uni-Bochum * * Universitaetsstr. 150 * * D-44780 Bochum * * Tel: +49 234 700 6434 * * Fax: +49 234 709 4162 * * http://www.lstm.ruhr-uni-bochum.de/~demmer * *************************************************************