I'm trying to create a menu using ncurses, I found some useful code and help online, but the code has errors in it. And I can't figure out why I'm generating this error. On top of all this, theres no way I'll be able to use the information I've found until I figure out how to correct this.
here is the code generating the error with a comment pointing to the specific line
while((c = getch()) != KEY_F(1))
{ switch(c)
{case KEY_DOWN:
menu_driver(my_menu, REQ_DOWN_ITEM);
break;
case KEY_UP:
menu_driver(my_menu, REQ_UP_ITEM);
break;
case 10: /* Enter */
{ITEM *cur;
void (*p)(char *);
cur = current_item(my_menu);
p = item_userptr(cur); //<<<<<<< This line is generating this error:
//main.cpp:70: error: invalid conversion from `void*' to `void (*)(char*)'
p((char *)item_name(cur));
pos_menu_cursor(my_menu);
break;
}
break;
}
}
from what I've read online item_userptr() will return a void*
any help would be appreciated