strange problem



> I have code that looks like this:
> 
> char tmp[2] = {0};
> char *tok[256];		//this contains 256 2 character strings
> 
> for (y=0; y<256; y++)
> {
> 	strcpy (tmp,tok[y]);
> 	//printf("tmp is %s\n",tmp);
> 	gtk_label_set_text(GTK_LABEL(
> 		labelArray[y]),tmp);
> }
> 
> 
> If I comment out the gtk_label_set_text and include the printf statement, it
> works fine. However when i include gtk_label_set_text tmp gets totally screwed
> up - printf jump prints rubbish. I cant understand what gtk_label_set_text is
> doing to change the tmp variable.
> 
> Any ideas?
> 
> Or a better way to tokenize 256 labels (they are read from a file into a
> buffer of 1 line) and write them back into a labelArray?
> 
> Eamonn

P.S I tried passing the tmp variable to a seperate function to set the 
text but it made no difference.




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