I'm trying to compare two strings in my program and even though the strings are the same, it fails the test.
Code:
if(curr->next == NULL)
if(g_ascii_strcasecmp(status_and_combo->data->name, selected_name))
return status_and_combo->data->mem_add;
return NULL;
Each time run, it will skip the nested return and return NULL;
Both g_ascii_strcasecmp and g_strcasecmp give the same result. I understand that g_strcasecmp should not be used anymore, so I was wondering if there was any other way to compare. All the letters are ascii so I assumed that g_ascii_strcasecmp would work.
status_and_combo looks as such:
Code:
typedef struct status_and_widget {
GtkWidget *widget;
GtkWidget *status_bar;
bt_node *data;
gchar* current_selected;
} status_trans;
data looks as such:
Code:
typedef struct bluetooth_node {
char* name;
char* mem_add;
struct bluetooth_node* next;
} bt_node;
and selected_name is a const gchar*.
The only thing I can think that would cause it to fail is that one is a const gchar* and one is a char*. I have attempted to cast the data->name as a const gchar* and that did not work.
If anyone knows what is happening and why it will not work, it would be appreciated.
Thanks
Brian