TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: VICTOR KEMP
from: BOGDAN SHEPTUNOV
date: 1998-01-16 22:28:00
subject: Re: converting char to string

Hello Victor.
13 Jan 98 20:05, Victor Kemp wrote to All:
 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 
t
 VK> says it can't convert int to char * when I do this:
 VK>            char charvar;
 VK>            char stringvar[90];
 VK>            strcat(stringvar, charvar);
You may use sprintf. Something like this:
    sprintf(stringvar,
            "%s%c,
             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.
Ofcourse. Char is not null-terminated.
Bogdan
---
---------------
* Origin: Crematory (2:463/285.82)

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™.