[comp.lang.c] When to use xalloc

creps@silver.bacs.indiana.edu (Steve Creps) (02/18/88)

   I'm running into a little confusion using strings in C, namely when
should I allocate space for them? I would appreciate any hints or rules-
of-thumb to use. The main problem I'm having is in a routine I'm writing
which reads strings into fields of a struct type. The strings are of
unknown length before I read them. Do I need to call an alloc() routine
first? The problem with this is how can I know how much to allocate? Also,
since they are returned by the routine, when should I free the space used
for them?
   Thanks in advance, as they say.

Disclaimer: I know quite a bit more about C than this question makes it sound.

-	-	-	-	-	-	-	-	-
Steve Creps on the VAX 8650 running Ultrix 2.0-1 at Indiana University.
creps@silver.bacs.indiana.edu, ...iuvax!silver!creps, creps@iubacs.bitnet
"Louisville Slugger baseball bats are made in Indiana"