Standard_Real to Stasndard_CString

Hi guy,

How am I able to convert Standard_Real to Standard_CString?

I know it is a very stupid question. Please help if you know how!!


Rob Bachrach's picture

It's not a stupid question, but an easy one to answer.
Remember, Standard_CString is a typedef to a char* and
Standard_Real is a typedef to a double. The easiest way
to convert is to create a character array and use sprintf.
You can also use strstream (or Standard_SStream) and use
stream operators and manipulators, but this is probably
more overhead than is necessary.

Fabio Napodano's picture

for future reference:
TCollection_AsciiString has a constructor which requires a Standard_Real value