Hallo,
I want to represent floating point numbers in German format, i.e.:
3,1415 instead of 3.1415. To do so I use the method
setlocale(LC_NUMERIC, "GERMAN"), which is provided by the header file
locale.h. This works pretty well with my C++ Compiler under Linux, but
does not work at all with the Compiler of SUN OS 5.6.
So I want to know if there is a way to set locales with the SUN OS
compiler. May be that I used something deprecated or that there is a
better way to set locales or that my syntax was not correct.
To circumvent the problem I tried something like this:
ostrstream os;
double floatingPoinNumber = 6.45;
string floatingPoinNumberAsString;
os << floatingPoinNumber;
floatingPoinNumberAsString = os.str();
floatingPoinNumberAsString.replace(timeStr.find("."), 1, ",");
cout << floatingPoinNumberAsString << endl;
So if somebody could tell me how I can clear my stream in the way that I
erase the inserted and converted number and can reuse the stream, this
would help me also. Unfortunately I have to use this stream stuff,
because sstream does not exist on SUN OS 5.6.
Thx Stefan