Re: Trash after build string

On 27 May 2001 23:23:21 -0400, Magnus Wirström wrote:
> Hi
> I am trying to build a command string that uses tar. To try this I made
> this small fuction to do some experimenting on. When I use g_strconcat I
> get trash after the actual string. If I understand the API correct both
> g_strdup and g_strconcat should NULL hte string itself... Anyone know
> what is wrong ?
>   tar = g_strdup("tar ");
>   test = g_strconcat(tar,"-x);

[ Assuming you meant g_strconcat(tar, "-x"); ]

You must NULL terminate calls to g_strconcat, as such:

test = g_strconcat(tar, "-x", NULL);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]