|
Pass char * list as function parameter |
James Stanley
Member #7,275
May 2006
|
I am writing a text spinner control for my GUI, and when creating the control, I have a function called new_selection. One of the parameters is a list of the values that can be selected. At the moment it is char *values[], but it causes a segfault when a value is accessed. The create code is:
NOTE: This is actually compiled as C++ and the file name is gui.cpp, but I do not like to use C++ and I am only using so that I will be able to use OpenLayer. Also, there is nothing wrong with my new_button() function. It works fine on it's own. The offending peice of code is: selection->values[selection->value]
It is passed as the value parameter to textout_centre_ex. Can anybody suggest a way of fixing this? EDIT: |
Three Harris
Member #6,226
September 2005
|
I am not 100% sure but it looks like you might have a fence-post error. Doesn't your compiler give you some kind of warning about char *values[] being assumed to be of size 1? [on a second note] |
James Stanley
Member #7,275
May 2006
|
No, there were no warnings at all. It doesn't matter anymore anyway. |
|