user2341069 user2341069 - 3 months ago 9
C Question

Getting the first 10 characters of a string?

I have not been able to find any information with a web-search. Where should I be looking?

Answer
char myString[256];
char dest[256]

strncpy(dest, myString,10);
dest[10] = 0; //null terminate destination
Comments