Even better:
-- ~Rick <[EMAIL PROTECTED]> wrote:
>
> I am trying to print the address of a variable, not the contents of it.
>
> Using printf, I would say:
>
> printf("Allocated %ld bytes at %p\n", bsize+1, fbuf);
>
> but I want to use the C++ features using cout/cerr. I've tried the
> following but get garbage:
>
> long int bsize = 1023;
> char *fbuf;
> fbuf = new char[bsize+1];
> if (fbuf)
> {
// Let the compiler work for you:
cerr << "Allocated " << (bsize+1) << " bytes at " << (void*)fbuf <<
endl;
> delete [] fbuf;
> }
>
> I have searched but can only find ios flags for dec, hex, oct but not
> for ptr. What is the "secret" here?
>
> ~Rick