Format.convert problme

Frank Benoit keinfarbton at googlemail.com
Sat Apr 4 23:35:16 PDT 2009


Qian Xu schrieb:
> Hi All,
> 
> tango.text.convert.Format provides a nice function to convert anything
> to string.
> 
> It works perfect except the argument is a pointer type.
> It will print the address of a pointer instead of its value
> 
> For instance: --------------------------------
> int* i = new int;
> *i = 10;
> Format.convert("{}", i); // <- the address of the pointer
> ----------------------------------------------
> 
> How to let it print the value instead of the address?
> Because I wanna write a dump function to dump the value of any data type
> (also void, null)
> 
> 
> 
> 

This is not really an exact answer to your question... :)
It seems you want to output trace information. Stdout (which seems you
are using) is not thread safe and will generate AV/segf if accessed
concurrently.
Specially for printing trace info, there is
tango.util.log.Trace
it is a Stdout replacement that is synchronized, and it also has a
memory() function, that lets you print raw memory as a dump.


More information about the Digitalmars-d-learn mailing list