C Programming help .....

Ben Duncan ben
Tue Jan 25 10:20:43 PST 2005


Ok, I need to to know how to copy/duplicate something in
a structure.

Given:
---------------------------------------------------------

typedef struct _mastermenu
        {
          int  MM_lineid ;
          char MM_item [16] ;
          char MM_menu [8] ;
        } MasterMenu ;

   MasterMenu MasterItems [8] = {
        1, "Daily", "DAILY",
        2, "Reports", "REPORT",
        3, "Periodical", "PERIOD",
        5, "Master Files", "MFILES",
        6, "App Setup", "SETUP",
        8, "Utilties", "UTILS",
        9, "System", "SYSTEM",
        10, "Jump to", "JUMP"
      } ;

   struct _extended_menu
      {
        int somenumber ;
        char a_char ;
        char a_buffer [80] ;
        MasterMenu [10] ;
       }

    struct _extended_menu A_TEST_MENU ;
    struct _extended_menu A_ARRAY_MENU [20] ;

------------------------------------------------------------

Where _mastermenu/MasterMenu is just a menu set.
MasterItems is the "Master" start set.
_extended_menu is a structure to contain MasterMenu
A_TEST_MENU is a single extened menu, A_ARRAY_MENU is an
array of extended_menu for 20 .

I want to copy MasterItems into:

A:       A_TEST_MENU.Mastermenu[0]
B:       A_ARRAY_MENU[0].MasterMenu[0]

So, what is the syntax for doing the copy?

ALSO .... Can and what would be the procedure if I wanted to
set A_TEST_MENU and A_ARRAY_MENU to NULLS to make sure they
contained nothing?

Thanks ...


-- 
Ben Duncan   - VersAccounting Software LLC 336 Elton Road  Jackson MS, 39212
"Never attribute to malice, that which can be adequately explained by stupidity"
        - Hanlon's Razor



More information about the Linux-users mailing list