Re: Trash after build string
- From: Joe Shaw <joe ximian com>
- To: Magnus Wirström <asdlinux linux se>
- Cc: Gnome-devel <gnome-devel-list gnome org>
- Subject: Re: Trash after build string
- Date: 30 May 2001 18:56:09 -0400
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);
Joe
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]