??? 09/28/04 10:38 Read: times |
#78246 - RE: Keil strncpy function doubt????? Responding to: ???'s previous message |
Dear All,
I just went through both the commands on the keil site. memcpy says memcpy Summary #include <string.h> void *memcpy ( void *dest, /* destination buffer */ void *src, /* source buffer */ int len); /* bytes to copy */ Description The memcpy function copies len bytes from src to dest. If these memory buffers overlap, the memcpy function cannot guarantee that bytes in src are copied to dest before being overwritten. If these buffers do overlap, use the memmove function. and strncpy says strncpy Summary #include <string.h> char *strncpy ( char *dst, /* destination string */ char *src, /* source string */ int len); /* max characters to copy */ Description The strncpy function copies at most len characters from src to dst. Here nothing of overlaping was mentioned in strncpy so I thought it is safer to use strncpy. But for my code both the functions will function same. Kindly correct me! Thanks Sachin |