problems with the memory handling



Hi list 

I write a program which is connected a server. my problem now is that the
structure does not store the values.

The structure is global

struct register
   {
   char *user, *clav, *srv;
   } host;

the source in GTK is:

   label=gtk_label_new("User");
   gtk_box_pack_start(GTK_BOX(box),label,TRUE,8,0)
   gtk_widget_show(label);

   login=gtk_entry_new();
   gtk_widget_set_usize(login,155,-1);
   gtk_signal_connect(GTK_OBJECT(login),"activate",
                      GTK_SIGNAL_FUNC(login), login)

the function login is: 

   void login(GtkWidget *widget, gpointer data)
   {
   static char *tmplog;

   tmplog=gtk_editable_get_chars(GTK_EDITABLE(widget), 0, -1);
   host.user=tmplog;
   }

int tmplog store memory, in host.user=tmplog assign the memory but when I 
require it in another function it does not have value for example:

int ServerConnect(void)
   {

           LOGINREC *login_u;      /*this is properly for DB-libraries of Sybase
           DBPROCESS *dbproc1;

           login_u=dblogin();
           DBSETLUSER(login_u,host.user);  /*value that it has host.user
...
...
...
   }

what is the problem?, I think that in the function login the value is lost

any idea?

THANKS


-------------------------------------------------
Obtén tu correo en www.correo.unam.mx
UNAMonos Comunicándonos




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