void ToPointerString(void* pv, char* sz) { CChars c; IToA((int)(ENGINE_SIZE_T)pv, sz, 16); c.Init(sz); c.RightAlign('0', 8); c.Insert(0, "0x"); strcpy(sz, c.Text()); c.Kill(); }
////////////////////////////////////////////////////////////////////////// // // // // ////////////////////////////////////////////////////////////////////////// void SFloat4::ToString(CChars* psz, int iWholeNumbers, int iDecimals) { CChars sz; int iWidth; if (iWholeNumbers == -1) { iWholeNumbers = WholeNumbers(); iWholeNumbers++; if (iWholeNumbers < 2) { iWholeNumbers = 2; } } iWidth = iWholeNumbers + 1 + iDecimals; psz->Append('['); sz.Init(); sz.Append(x, iDecimals); sz.RightAlign(' ', iWidth); psz->Append(sz); psz->Append(','); sz.Clear(); sz.Append(y, iDecimals); sz.RightAlign(' ', iWidth); psz->Append(sz); psz->Append(','); sz.Clear(); sz.Append(z, iDecimals); sz.RightAlign(' ', iWidth); psz->Append(sz); psz->Append(','); sz.Clear(); sz.Append(w, iDecimals); sz.RightAlign(' ', iWidth); psz->Append(sz); psz->Append(']'); sz.Kill(); }
BOOL CChars::AppendData2(const char* szData, int iDataLength) { int i; int iPrintable; unsigned char c; float fPrintable; CChars sz; iPrintable = StrPrintable(szData, iDataLength); fPrintable = (float)iPrintable / (float)iDataLength; if (fPrintable >= 0.9f) { Append(szData, iDataLength); return FALSE; } else { Append("0x"); sz.Init(); for (i = 0; i < iDataLength; i++) { c = szData[i]; sz.Clear(); sz.Append((int)c, 16); sz.RightAlign('0', 2); Append(sz); if (i != iDataLength - 1) { Append(' '); } } sz.Kill(); } return TRUE; }