Coder's Guild Mailing List

Re: Concatenate strings

Posted by Fox on 2000-05-24

> hi all,i have a problem whereas I have a number of strings (5) that i wish
> to concatenate together each seperated by a comma , and beginning with a
> comma, I have done it as so
> char str[75];
> strcat(str,comma);
> strcat(str,s1);
> strcat(str,comma);
> ... strcat(str,s5);
> is it possible to make this a bit cleaner,i hav thought of a loop,but hav no
> idea how to implement it,any suggestions appreciated
> Cheers Gazza

/*****************************************/

	I can't figure any way out to make it cleaner.  Any way I think of using the 
loops would eliminate the strcat function completely and make the whole thing 
more complicated.
	If anyone else has an idea about makeing it cleaner, I'm all ears, too.  I don't 
know of a way.
*******************************************
My brain is powered by C++
My hands are trained for the keyboard
My legs are built for the hockey floor
My ears are tuned to Mike Oldfield
My eyes are sensitive to video games
My attitude is sarcastic
My body is the work of God!