Help, I need filter text in function



Hi list

I write a function it admit numbers, the function is: 

void edit_clv_plt(GtkWidget *widget, gpointer data) {
  char *tmpplt;
  char ch = *((char *) data);
  char *str;
 
  str = (char *) data;
 
  if(isdigit (ch) && strlen (str) == 1) { /*introducing a number*/
     g_free(host.plt);                   
    
     /*it obtains the chain*/
     tmpplt=gtk_editable_get_chars(GTK_EDITABLE(widget),0 ,-1); 
     host.plt=g_strdup(tmpplt);
    
  } else {
    Messages("Error","Write the number");  /*Function for Show Messages*/
  }
}                                  

The user write the numbers, in GtkEntry, the text is not allowed, the max digits
is 3, but when running the program write a text, call function Messages, if
write a number, call a function Messages, where this the error

-------------------------------------------------
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]