Re: [C] strlen, strcat and malloc

From: Alwyn (dt015a1979_at_mac.com.invalid)
Date: 07/30/04


Date: Fri, 30 Jul 2004 02:10:14 +0100

In article
<Pine.LNX.4.60-041.0407291146130.28809@unix42.andrew.cmu.edu>, Arthur
J. O'Dwyer <ajo@nospam.andrew.cmu.edu> wrote:

> More usefully: The /first/ strcat produces undefined behavior.
> The OP originally had
>
> a = malloc(foo);
> strcat(a, bar);

The OP has been doing this kind of thing since I joined this newsgroup,
despite repeatedly having his mistakes explained to him.

Fatted, move on to Python or Ruby or a myriad other languages I could
mention. Their string handling is a lot more intuitive and elegant.

Alwyn



Relevant Pages