[ILUG] C string concat question ??

From: Glen Gray (glen at domain antefacto.com)
Date: Wed 02 May 2001 - 17:59:54 IST


Looking for a simple way to cat two strings into a third.

I had the following in my code

msg = strdup(strcat(strvar1, strvar2));

What happens here is the strvar2 is concatinated to strvar1 and a
pointer to strvar1 is returned to strdup which allocates memeory for the
char *message variable.

What I want is that functionality without strvar1 being modified. I
would rather not have to create my own buffer and do it over two lines.

I thought this was interesting as I couldn't see and alternative to
strcat. Hope someone else can.

Glen



This archive was generated by hypermail 2.1.6 : Thu 06 Feb 2003 - 13:10:09 GMT