Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!uunet!seismo!ut-sally!husc6!cmcl2!brl-adm!adm!dsg@mitre-bedford.arpa
From: dsg@mitre-bedford.arpa (Dave Goldberg)
Newsgroups: comp.lang.c
Subject: building a list on the fly
Message-ID: <8234@brl-adm.ARPA>
Date: Thu, 9-Jul-87 11:38:32 EDT
Article-I.D.: brl-adm.8234
Posted: Thu Jul  9 11:38:32 1987
Date-Received: Sun, 12-Jul-87 04:58:01 EDT
Sender: news@brl-adm.ARPA
Lines: 30


I am trying to build a list from data read in from a file.  This list will
eventually be used as an argument to the Maryland Menus MUcreate function.
When I give the list some huge allocation as a default ie:

    char list[HUGENUM][HUGENUM]; 

The MUcreate function crashes on a strlen call.  My list has a maximum strlen
of 42 chars, and I have used longer menu entries in constant strings before,
so that is not the problem.

When I try to dynamically allocate the list, I don't get a crash, but along
with the desired list in the menu, I also get some blank entries and/or some
garbage depending (it seems) on the length of the list.  Most likely, my
problem is my inexperience with dynamic allocation in C.  I would like to
allocate only the number of entries, and leave the entries at a constant
width.  I think that Menus will accept that.

Please mail me any responses, as this seems to be a somewhat of a novice
request, and I don't want to clutter the net.

Thanks in advance,

Dave
--------------------------------------------------------------------------
Dave Goldberg	             ARPA: dsg@mitre-bedford.arpa
The Mitre Corporation        UUCP: linus!dsg (gets forwarded to the above)
MS B015
Bedford, MA 01730
617-271-2460