Help, problems with the struct...
- From: <javiercmx correo unam mx>
- To: <gtk-app-devel-list gnome org>
- Subject: Help, problems with the struct...
- Date: Fri, 20 Jul 2001 13:54:10 -0500
Hello List
I write a program which is connected a server. my problem now is that the
structure does not store the values. when I require the values there is nothing
the code is:
the struct is
struct register
{
char *user, *clav, *srv;
} host;
for GtkEntries
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)
label=gtk_label_new("Passwd");
gtk_box_pack_start(GTK_BOX(box),label,TRUE,10,0)
gtk_widget_show(label);
passwd=gtk_entry_new();
gtk_widget_set_usize(login,155,-1);
gtk_signal_connect(GTK_OBJECT(passwd),"activate",
GTK_SIGNAL_FUNC(passwd), passwd)
label=gtk_label_new("Server");
gtk_box_pack_start(GTK_BOX(box),label,TRUE,10,0)
gtk_widget_show(label);
server=gtk_combo_new();
gtk_widget_set_usize(170,-1);
gtk_signal_connect(GTK_OBJECT(GTK_COMBO(server)->entry,"activate",
GTK_SIGNAL_FUNC,server)
gtk_combo_disable_activate(GTK_COMBO(server));
gtk_box_pack_start(GTK_BOX(box),server,TRUE,10,0)
the function for User is
void login(GtkWidget *widget, gpointer data)
{
gchar *tmplog;
tmplog=gtk_editable_get_chars(GTK_EDITABLE(widget), 0, -1);
strcpy(host.user,tmplog);
g_free(tmplog);
}
for Passwd is
void passwd(GtkWidget *widget, gpointer data)
{
gchar *tmppass;
tmppass=gtk_editable_get_chars(GTK_EDITABLE(widget), 0, -1);
strcpy(host.user,tmplog);
g_free(tmplog);
}
for server is
void server(GtkWidget *widget, gpointer data)
{
gchar *tmpsrv;
tmpsrv=gtk_editable_get_chars(GTK_EDITABLE(widget), 0, -1);
strcpy(host.user,tmplog);
g_free(tmplog);
}
when press de button conect call de function call_host
the function is
void call_host(GtkWidget *widget, gpointer data)
{
ServerConnect();
}
the function that it makes the connection is
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
DBSETLPWD(login_u,host.clav); /*value that it has host.clav
DBSETLENCRYPT(login_u,(DBBOOL)1);
dbproc1=dbopen(login_u,host.srv); /*value that it has host.srv
dbcmd(dbproc1,"use master");
if(dbsqlexec(dbproc1)==FAIL)
{
printf("Error\n");
return -31;
}
else
{
dbresults(dbproc1);
dbnextrow(dbproc1);
}
}
I use DBSETLUSER(login_u,&host.user);
but in the structure not this stored nothing, and it is not connected, where is
the problem?
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]