[En-Nut-Discussion] Curious behaviour with strcat(tdp->td_name, "\n")

Pavel Chromy chromy at asix.cz
Sun Jul 24 12:15:16 CEST 2005


Marcel Bariou napsal(a):
> The following is a modified version  of  Harald threads example. When I add the last line :
> puts(strcat(tdp->td_name,"\n"));
> I find out a quick degradation of the output, have somebody an idea about ?

You cannot use it like that as strcat concatenates the second string to 
the first one thus possibly corrupting memory begind the first string.
I suppose that you did not intended this. You should rather use printf.

Pavel



More information about the En-Nut-Discussion mailing list