From: ao950 AT FreeNet DOT Carleton DOT CA (Paul Derbyshire) Newsgroups: comp.os.msdos.djgpp Subject: Re: Boy do I feel STUPID!! ....Files question... Date: 28 Aug 1997 09:13:40 GMT Organization: The National Capital FreeNet Lines: 20 Message-ID: <5u3fg4$cvj@freenet-news.carleton.ca> References: Reply-To: ao950 AT FreeNet DOT Carleton DOT CA (Paul Derbyshire) NNTP-Posting-Host: freenet6.carleton.ca To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Andrew Deren (aderen AT eecs DOT uic DOT edu) writes: > But you won't save char *name part of the structure. You only will save a > pointer to that name. I would consider changing declarations in S_MAP to > char name[15]; or whatever is the maximum number of chars in name. > You have to be careful about saving structs to disk. You have to watch out > for pointers inside the struct. I know, I was answering the general question of how you write an array of things to disk. Obviously, when there are embedded pointers, it is necessary to do some fudge around it or other. Best is to either allocate fixed-size strings, replacing that with char foo[nnn], or to use a record by record disk write, with a function write_record(FILE *f, struct foo bar) used to write one of struct foo to filestream f, and call it n times from a loop. -- .*. Where feelings are concerned, answers are rarely simple [GeneDeWeese] -() < When I go to the theater, I always go straight to the "bag and mix" `*' bulk candy section...because variety is the spice of life... [me] Paul Derbyshire ao950 AT freenet DOT carleton DOT ca, http://chat.carleton.ca/~pderbysh