Re: [ILUG] C string concat question ??

From: kevin lyda (kevin at domain suberic.net)
Date: Wed 02 May 2001 - 23:07:57 IST


On Wed, May 02, 2001 at 09:52:40PM +0100, Dave Neary wrote:
> And my first instinct...
> strcat(msg=strdup(strvar1),strvar2);
> doesn't work because you can never be sure what order the
> arguments will evaluate. So strcat might cat strvar2 on the
> (uninitialised) msg before strdup over-writes it with strvar1.

actually the order of evaluation isn't the problem. you haven't allocated
enough space for strvar2.

kevin

-- 
kevin at domain suberic.net          "nobody likes a monkey on their back.  i had
fork()'ed on 37058400      three.  they were cramping my style.  it was
meatspace place: home      time to get rid of them."
http://suberic.net/~kevin                --porter, "payback"


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