Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!rutgers!mcdchg!documail!rich From: rich@documail.UUCP (Rich McCallister) Newsgroups: comp.sys.amiga.programmer Subject: Re: Problems with string handling... Summary: Memory allocation Message-ID: <303@documail.UUCP> Date: 20 Feb 91 22:45:25 GMT References: <22209@hydra.gatech.EDU> Organization: Bell & Howell DocuMail Division, Evanston, Ill. Lines: 17 In article <22209@hydra.gatech.EDU>, gt1619a@prism.gatech.EDU (Net Runner Mark V) writes: > Problem: system crashes when I do this. It gets as far as the string copy, > but falls apart at the string concatenation . I'm using Manx. > > char type[2], *seqName, *tblName, *string; > - . - > fscanf(input," %s;",string); > strcpy(seqName,string); > strcat(seqName,".seq"); If you are using malloc() or AllocMem() or some such thing to allocate memory for 'string' and 'seqName' before using them; and if input size (the characters after the leading blanks in the input and before the semicolon) are GUARANTEED to fit into the allocated space; and if 'string' is not left unfilled by fscanf (which would allow the possiblity of 'string' pointing to a memory area which contained several hundred bytes before the first NULL); then I see nothing obvious.