Posted: Sat Mar 13, 2010 9:07 am Post subject: Converting a space separated list into an array
One little task that I was working on yesterday was converting a string in the form of a list space separated items, into a NULL terminated array. Ok, its simple in Tcl, but not so straight forward in C. Imagine this as:
I’ve thought of ‘tokenizing’ the source string and dynamically building an array, but then, there’s no assurance that each entry in the new array will have the same size. That is, instead of “but1 but2 but3” might, during run time, be “b1 but2 button3” or something similar.
The idea of to allow me to successfully complete the following line of code to complete the loading of portions of a builder UI xml file into a pre-existing container object. This is the relevant command.