I have a string, let\'s say \"THESTRINGHASNOSPACES\".
I need something that gets a substring of 4 characters from the string. In the first call, I should get \"THES\
#include #include int main() { char src[] = "SexDrugsRocknroll"; char dest[5] = { 0 }; // 4 chars + terminator */ int len = strlen(src); int i = 0; while (i*4 < len) { strncpy(dest, src+(i*4), 4); i++; printf("loop %d : %s\n", i, dest); } }