[vtkusers] Set decimal digits in vtkVariant

Jeff Baumes jeff.baumes at kitware.com
Tue Jan 25 11:17:35 EST 2011


On Tue, Jan 25, 2011 at 9:15 AM, Xiaopeng Yang <yxp233 at postech.ac.kr> wrote:

> Greetings!
>
>
>
> May I ask how to set decimal digits in vtkVariant? For example, I would
> like to set one decimal digit for the double type variable: vol2/1000.
>
>
>
> Here is part of my code:
>
>
>
> std::string message = "Resected volume = ";
>
> message += vtkVariant( vol2/1000 ).ToString();
>
>
There is currently no way of doing this with vtkVariant. The conversions use
the default settings of STL ostringstream and there is currently no API to
change them. The string conversions are meant to produce something
reasonable for presentation (e.g. for displaying in a UI text box), but not
for anything rigorous like serialization. You should go through a more
standard technique (e.g. ostringstream) to accomplish this.

Jeff
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110125/a462efb9/attachment.htm>


More information about the vtkusers mailing list