TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: ADAM MAJER
from: HERBERT BUSHONG
date: 1998-01-18 04:53:00
subject: converting char to string

::> HB>char charvar;
::> HB>char stringvar[90];
::> HB>char stringret[91];
::> HB>sprintf(stringret, "%s%c", stringvar, charvar);
::> This takes a long time to execute though
::>     int i = strlen(stringvar);
::>     stringvar[i++] = charvar;
::>     stringvar[i] = NULL;
::> The above is much faster. ;-)
different strokes...  That's probably how I would have done it too, except
the last line being:
stringvar[i] = '\0';   // or NUL
That's what I get for typing code while half asleep ;)
#  Herbert Bushong    harchon@centuryinter.net       [TEAM OS/2]    
-  Blackbeard's BBS   Intelec: 239:600/0            
+  Fido: 1:19/19      http://www.intelec.com/software/
---
   RM 1.31 2508   Date Catholic girls, they never confess ...
---------------
* Origin: Blackbeard's BBS - Ville Platte, LA - 318-468-3385 (1:19/19)

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