Subj : Need help with converting float to string To : borland.public.cpp.borlandcpp From : Jeff Baker Date : Sat May 22 2004 03:51 am I need some help. The function listed below compiles and works but the format it displays is not the kind I need. This function displays "data" in exponential format and I need it to be in decimal format and no suppression of trailing zeros. The ecvt() and fcvt() functions do exactly what I'm looking for, however neither of these functions insert the decimal in the string. Does anyone have an idea on how to get this done? Note: the data is always in x.xx format. [start of code] #include #include void DisplayData(HWND hwnd,BYTE low_byte,BYTE high_byte) { char string[255],label[]="Data"; float data; HDC hdc; RECT rect; rect.left = 210; rect.top = 10; rect.right = 340; rect.bottom = 23; HBRUSH back_color = (HBRUSH)GetStockObject(BLACK_BRUSH); COLORREF text_color = RGB(127,255,127); HFONT hfnt,hOldFont; hdc = GetDC(hwnd); SetTextColor(hdc,text_color); SetBkMode(hdc,TRANSPARENT); hfnt = (HFONT)GetStockObject(SYSTEM_FONT); hOldFont =(HFONT)SelectObject(hdc,hfnt); if (hOldFont) { FillRect(hdc,&rect,back_color); TextOut(hdc,rect.left,rect.top,label,strlen(label)); data = (FLOAT)((low_byte + (256 * high_byte)) / pow10(2)); gcvt(data,4,string); TextOut(hdc,rect.left+80,rect.top,string,strlen(string)); SelectObject(hdc,hOldFont); } UpdateWindow(hwnd); ReleaseDC(hwnd,hdc); } [end of code] .