c get first n characters of string

C
char myString[256]; // Input string
char dest[256];     // Destination string

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

Also in C: