One way is to use strncpy()
It will copy a string to the length given, or if it finds a NULL in the source string, will stop, and fill the remaining bytes of the destination with NULLs.
One thing to note about strncpy() is that it does not automatically NULL terminate the destination string (as strcpy() does), so you need to either NULL terminate the destination before the strncpy() or NULL terminate it after the strncpy(). In the following example I have used the former option.
Compile, load, and run. Try to understand what each statement does, then adapt it to your sketch.
char str[] = {"1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-=:;<>?,./~`!@#$%^&*()_+0987654321END!"};
char outputStr[26] = {0};
void setup() {
Serial.begin(115200);
Serial.println(str);
strncpy(outputStr, &str[0], 25); // the & gives the address of str[0]
Serial.println(outputStr);
strncpy(outputStr, &str[25], 25); // the & gives the address of str[25] (and so on)
Serial.println(outputStr);
strncpy(outputStr, &str[50], 25);
Serial.println(outputStr);
strncpy(outputStr, &str[75], 25);
Serial.println(outputStr);
}
void loop() {
// put your main code here, to run repeatedly:
}
Edit: I hate it when I hit the QUOTE tag icon instead of the CODE tag icon!