Re: [gtk-list] Re: GList problem




> > for(i = 1; i <= WEEKS; i++)
> > {
> >         sprintf(string, "Week %d", i);
> >         list = g_list_append(list, string);
> >         printf("%s\n", string);
> > }
> >
> > g_list_foreach(list, (GFunc) PrintList, NULL);


Change:
	void PrintList(char* str)
	{
	    puts(str);
	}

	list = g_list_append(list, string);

to:
	void PrintList(GString* gstr)
	{
	    puts(gstr->str);
	}

	list = g_list_append(list, g_string_new(string));

- Dave

-- 
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS dpu s-:+ a C++$ ULS++$ P+++$>++++ L++>+++$ E+>++ W N++ !o K w++$ O !M-
!V(-) PS+ PE- Y+ PGP !t-- 5++ X R tv b+ DI+++ D G e++ h--- r+++ y++++
------END GEEK CODE BLOCK------



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