Hi Victor,
VK> Hi, how do you convert a char to a string?
VK> char charvar;
VK> char stringvar[90];
VK> strcat(stringvar, charvar);
Add a function like:
char* chcat(char* str, char ch) {
static char tmpstr[2]=" "; /* create a 1-char + NUL string */
tmpstr[0] = ch; /* change the char to ch */
return strcat(str, tmpstr); /* append it to str and return */
}
This still uses strcat for all the complicated stuff, and should be almost
he
same in efficiency terms. Once you've got this done, your example goes like:
char charvar;
char stringvar[90];
chcat(stringvar, chvar);
P.S.: I got this message in the C_PLUSPLUS area... if you're doing it in C++,
it's much easier - look up the String class in your manuals.
Later,
- Lee
---
Lee Braiden
FIDO: 2:443/777.3 EMail: lee.braiden@coole.piglets.com
--- FIPS/32 v0.98 W95/NT [Unreg]
---------------
* Origin: Oppression is nine tenths of the law (2:443/777.3)
|