Hello Victor.
15 Jan 98 15:38, Victor Kemp wrote to All:
VK> Anyway I need to append a char onto the end of a string, something like
VK> this
VK> char stringvar[90];
VK> char charvar;
VK> strcat(stringvar, charvar);
VK> But that doesn't work, someone please tell me how it's done.
If the string length is known you can, assuming there is room
in the array, assign the char to the last element +1 and then
assign a nul just after...
int len;
len = strlen( stringvar );
stringvar[ len ] = charvar;
stringvar[ len + 1 ] = '\0';
It is VERY important that you are sure there is enough room for
all the characters. One out of bounds array will crash your
program quick!
-Roger
... 'If it ain't broke, you can probably still fix it.' - Tim Allen
--- Msged 4.20 beta 2
(1:273/404@fidonet)
---------------
* Origin: Hodge-Podge Support BBS, Upper Darby, Pennsylvania, USA
|