Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Converting 0.000025 to a string

Status
Not open for further replies.

mpsoutine

Programmer
Joined
Jan 6, 2003
Messages
87
Location
US
Hi,

I'm having the following problem converting 0.000025 and other numbers with 0.0000xx format to a string and populating a list control with the value. I'm retrieving the information from a database

Here is the code I'm using in my PopulatList(). I works with 1.0000025.


void CTransactionSet::PopulateListControl(CListCtrl *pList)
{


int decimal, sign;

double dbValue = 0.0023;
CString strBuyerBrokerCommission;
CString strValue, strInt,strDecimal;
strValue = _fcvt(this->m_BuyerBrokerCommission,
6,&decimal, &sign);



strInt = strValue.Left(decimal);

strDecimal = strValue.Mid(decimal);


strBuyerBrokerCommission.Format("%s.%s",strInt,strDecimal);

pList->SetItemText(NextItem,3,strBuyerBrokerCommission);


}



 
how about:
strValue.format("%f", 0.000025);

Ion Filipski
1c.bmp

ICQ: 95034075
AIM: IonFilipski
filipski@excite.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top