I will try the solution from Rainer as it seems to do the least of disruption to my original code.
Thanks to you all, Edward On 11/09/2015, Edward Bartolo <[email protected]> wrote: > As suggested by tilt, I switched to use GSList but I need to use it > for two distinct cases: > a) to manage a list of strings > b) to manage a list of structures of this construct: > > typedef struct { > double quality; > char name[MAX_ESSID_LENGTH]; > } wifi_quality; > > I expect this to be possible as lists may not always be lists of strings. > > In the case it is possible to use GSList to manage lists of custom > structures like the above, which function the type of strdup is used > to allocate memory and prepare a structure so that it would be added > to the list? > > I also need to swap two items in the list in a sorting function. > > Edward > > On 11/09/2015, Rainer Weikusat <[email protected]> wrote: >> "tilt!" <[email protected]> writes: >>> On 09/11/2015 10:35 AM, Edward Bartolo wrote: >>>> Hi all, >>>> >>>> Since yesterday I have been trying to understand why "char** >>>> essid_list" is working inside getInstalledEssidList(&count, >>>> essid_list) but failing as soon as I try to access essid_list[0] >>>> outside the function. >>>> >>>> Both the source and the gdb text output are attached. >>>> >>>> Any helpful pointers are appreciated. >>> >>> Having dynamically growing (and shrinking) lists in C is >>> always a problem. That's why the problem has been solved >>> many times. :-) >>> >>> For example, the singly-linked list, GSList, from the GLIB >>> library is pretty popular and could save you some time. >> >> JFTR: That part of the code is works. >> _______________________________________________ >> Dng mailing list >> [email protected] >> https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng >> > _______________________________________________ Dng mailing list [email protected] https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng
