Trash after build string



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 ?

Thanks
Magnus
#ifdef HAVE_CONFIG_H
#  include <config.h>
#endif

#include <gnome.h>

#include "callbacks.h"
#include "interface.h"
#include "support.h"



void
on_configure_clicked                   (GtkButton       *button,
                                        gpointer         user_data)
{
  GtkWidget* tarsource;  
  
  gchar *tarfile;
  gchar *tarcommand;
  gchar *test;
  gchar *tar;

  tarsource = lookup_widget(GTK_WIDGET(button),"fileentry1");
  tarfile = gnome_file_entry_get_full_path(GTK_WIDGET(tarsource),TRUE);
  printf("Building tar command: new \n");
  printf("file entry line: %s\n",tarfile);
  tar = g_strdup("tar ");
  test = g_strconcat(tar,"-x);
  printf("Tar command: %s \n",test);
  /* system("./configure");*/
}


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