On Sun, Dec 02, 2001 at 12:29:08AM +1100, John wrote: > Sorry, forgot to mention, please ignore the log statements (just > debugging tools). And also, > even if I call strncpy(result, input_str, 20) it copies 20 characters, > then adds funny characters after that. > > > strncpy(result, input_str, strlen(input_str) - strlen(tmp2)); do (up above somewhere int size;) size = strlen(input_str) - strlen(tmp2); strncpy(result, input_str, size); result[size - 1] = '\0'; strncpy does not guarantee a NUL terminator. -Mysid -- +---------------------------------------------------------------+ | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html | | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html | +---------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 06/24/03 PDT