memcpy vs strncpy? hrm

DWW

Platinum Member
Apr 4, 2003
2,030
0
0
These two seem very similar
Any idea which is faster? I'm thinking memcpy might be?

 

Descartes

Lifer
Oct 10, 1999
13,968
2
0
There is a more appropriate software forum for this question, but anyway...

memcpy() will generally be faster as strncpy() handles the padding of the destination string with null characters if necessary. The performance different will be negligible, but strncpy() is used to copy strings, and memcpy() is used to copy bytes from one location to another without regard to its representation.
 

DWW

Platinum Member
Apr 4, 2003
2,030
0
0
There is a more appropriate software forum for this question, but anyway...

This forum is OFF-TOPIC though ;)
Anything goes and generally it has more action here heh.