| Refresh | Home EGTry.com


#copy the first n character
char holder[10];

char * retval=strncpy(holder, "a long string that only the first 10 characters is copied", 10);
retval[9]=0;
-
#less characters than available space
char holder[10];
char * retval=strncpy(holder, "a short", 10);