Can you explain the difference between memcpy and
strncpy function
Actually , please classify function by usage
Thanks
strncpy copies "at most" n bytes, ending at the first \0 seen in the source.
Personal note: strncpy() is one of the cursed functions in C most people
will (should) never use, as it may lead to unterminated destination.
<http://opengroup.org/onlinepubs/007908775/xsh/strncpy.html>
<http://www.opengroup.org/onlinepubs/009695399/functions/memcpy.html>
>pavunkumar a �crit :
>> Can you explain the difference between memcpy and
>> strncpy function
>strncpy copies "at most" n bytes, ending at the first \0 seen in the source.
And zero fills the rest!
It's only useful for copy strings to C structs, specifically when those
structs are then written to a file.
Casper
--
Expressed in this posting are my opinions. They are in no way related
to opinions held by my employer, Sun Microsystems.
Statements on Sun products included here are not gospel and may
be fiction rather than truth.