Menucurser programming, menu display exception

Source: Internet
Author: User
Menucurser programming, menu display exception-General Linux technology-Linux programming and kernel information, the following is read details. The code is as follows:
==========> Obtain the menu item function ================================== =====
MainItems = (ITEM **) calloc (80, sizeof (ITEM *));
I = 0;
While (fgets (sLine, sizeof (sLine), fp )! = NULL)
{
If (ParseLine (sLine, 2, sItem ))
{
// MainItems = new_item (sItem [0], sItem [1]); // 1
MainItems = new_item ("BBB", "AAAAA"); // 2
I ++;
}
}
============> Display menu functions ==================================== ====
Keypad (pWorkWin, TRUE );
MainMenu = new_menu (ITEM **) mainItems );

Set_menu_win (mainMenu, pWorkWin );
Set_menu_sub (mainMenu, derwin (pWorkWin, 6, 38, 10, 10 ));
Set_menu_mark (mainMenu, "> ");
Refresh ();

Post_menu (mainMenu );
Wrefresh (pWorkWin );
========================================================== =
Content of the file to which fp points:
0000 | AAAAA |
0001 | BBBBB |
0002 | CCCC |
Print and show that the content of sItem [0] sItem [1] is correct
If 2 new_item is used, the correct menu is displayed.

However, if 1 new_item is used, the menu is empty.

==========================================================

I don't know why.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.