user2341069 user2341069 - 1 year ago 99
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 Source
char myString[256];
char dest[256]

strncpy(dest, myString,10);
dest[10] = 0; //null terminate destination
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download