TH> TH>> char ch;
TH> TH>> char str[80];
TH> TH>> str[0] = ch;
TH> TH>> str[1] = 0;
TH> MB> 78 bytes wasted.
TH> Ha....................ha.......................
Since the initialization of a variable ensures that all
members not specifically assigned a value will be assigned
the value 0, one could do this, also:
char *CharCat(char *szStr, int iChar)
{
char szTempStr[2] = "";
szTempStr[0] = char(iChar);
strcat(szStr, szTemp);
return szStr;
}
The use or creation of a string class would still allow all
of this to go much quicker, since one could keep an int value
denoting the present length of the string as a class member
and append the new data at that point without having to look
for the string terminator. A few clock cycles here and there
in frequently used code will add up.
> ] A single step may begin a journey of 1,000 miles............
---
---------------
* Origin: *YOPS ]I[* 3.1 GIG * RA/FD/FE RADist * Milwaukee, WI (1:154/750)
|