TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: VICTOR KEMP
from: THIERRY MOURE
date: 1998-01-16 23:56:00
subject: Re: converting char to string

Thierry is replying to Victor who replied to All on 13 Jan 98 08:05pm
 VK> Hi, how do you convert a char to a string?
 VK> I would like to concatenate a single char onto the end of a string but
 VK> it says it can't convert int to char * when I do this:
 VK>            char charvar;
 VK>            char stringvar[90];
 VK>            strcat(stringvar, charvar);
 VK> I also tried doing:
 VK>            strcat(stringvar, (char *)charvar);
 VK> but that made a big mess of things although gave no error message.
 TM> Try this
        char *charvar;
        char stringvar[90];
        strcat(&stringvar[0],charvar);
        All the strxxx functions are working with pointer arguments, not
        directly with the char.
 VK> --- Courtesy of Silver Xpress
Thierry Moure
 * Evaluation copy of Silver Xpress. Day # 1
--- via Silver Xpress V4.01 [NR]
---------------
VK> * Origin: The Ultimate (3:771/340)
* Origin: Morte Lune, Toulouse, France (2:324/106)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.