When I create a literal string and add it to the menu, everything works fine. But if I input a string from the user, then the menu is "blank". I don't know if this is a curses/menu problem, or a C problem, as I am a beginner at both.
#include <curses.h>
#include <menu.h>
#include <malloc.h>
int main()
{
MENU *my_menu;
ITEM **my_items;
char c;
// works
char my_string[20] = "this is the string";
// user-inputted string, comment these 2 lines out to make this program work
printf("enter something: ");
fgets(my_string, 19, stdin);
initscr();
noecho();
crmode();
my_items = (ITEM **)calloc(2, sizeof(ITEM *));
my_items[0] = new_item(my_string, my_string);
my_items[1] = (ITEM *)NULL;
my_menu = new_menu(my_items);
post_menu(my_menu);
refresh();
while ((c = getch()) != 'q') { }
free_item(my_items[0]);
free_item(my_items[1]);
free_menu(my_menu);
endwin();
return 0;
}