Click here to Skip to main content
15,909,242 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i am trying to convert the float/double values to the string using the ostringstream

ostringstream ostr;
float m = 6.9293f;

ostr<<m;

it is working fine with these values :) but when i tried to give values having 0 after floating point like 3.0f it simply truncate the value to 3:confused:.
i dont want this thing to happen i want to get the walues as it is... :((
Posted

tush_2003 wrote:
thanks for instant reply but i have already done all these things.
these thing are not working. i think its an internal problem of ostringstream

Because you didn't read carefully the documentation.

You have to apply the fixed manipulator (see the example here [^]).
:)
 
Share this answer
 
See the precision and width operators of the ios class[^].
 
Share this answer
 
thanks for instant reply but i have already done all these things.
these thing are not working. i think its an internal problem of ostringstream
 
Share this answer
 
hey great its working thank you!!!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900