Subj : Re: structures problem To : borland.public.cpp.borlandcpp From : Bob Gonder Date : Sat Jul 24 2004 10:45 am Viktor Popov wrote: > I have fixed the problem with allocating memory Did you fix the same problem in AtomNumber too? Also, you can't return a local string from AutoNumber. char*AtomNumber() { char number[whatever]; return number; } Does not work because "number" is overwritten very quickly. Two solutions to that. 1) Pass in a string that AtomNumber can write the result to. 2) Since you always do atoi(AtomNumber()), why not return the integer instead of a string? return atoi(number); > 3) (the best) Just skip 's' totally and use sse after returning. > void BuildSSE(FILE *fp,struct SSEList *sse) > Use the filled-in sse. > >If I use void BuildSSE, it doesn't seem that anything is copied into sse. This line > //write the number of the first atom in SSE > sse[br].num_beg=atoi(AtomNumber(str,21,25)); writes information into sse. Did you maybe mean that nothing is in s? .