Coder's Guild Mailing List

Overwting memory

Posted by Gary Lloyd on 2000-04-27

Hi all, my problem is a fairly simple one Im sure,but after many frustrating
weeks,i hav not been able to find a solution to it,basically what i'm doing
is passing a line of text from a file to a function,that reformats the
string,in the first pass to the function everything is fine,however in the
second pass everything is corrupted,that is the string has garbage in
it,memory has been allocated for it,I hav used memset to what i hoped would
clear any thing that was there previous,the string passed in is ok,but when
using strncpy(temp,passed,strlen(passed); it will not even print that at
using printf(),hope this is sufficient to explain my prob,the code is rather
long (500) lines
Many thanks in anticpation
Cheers gary