Null-terminated string: Difference between revisions

Content deleted Content added
Ktracy (talk | contribs)
No edit summary
Ktracy (talk | contribs)
mNo edit summary
Line 16:
 
To copy a C string correctly, the following format could be used
 
<code>memcpy(CstringDst, CstringSrc, strlen(CstringSrc) + 1);</code>
 
Where CstringDst is the destination C string to be copied into and CstringSrc is the source of the C string. The last argument will set the length of the destination C array. It will set this length to the length of the source plus 1 to account for the terminating character.