string to char array

hi

i have a custom hardware. i have to get data from that hardware and display on somewhere else.
i m reading its serial port , received data is a multi line string. i want to convert that string data to char array.
substring includes 12 char in 12 lines.
mystring.toCharArray() function is working is i want.
i mean 12 char of substring has to store on 12 array locations , however that's not happening .
my code to read serial port;

String str;
String str1;
char str2[100];
void setup()
{

Serial.begin(115200);

}

void loop() {

while (Serial.available()) {
str = Serial.readStringUntil('\n');
Serial.println (str);

str1 = str.substring(0,1);
Serial.println (str1);
}

}

serialString.jpg

serialString2.jpg

i want to convert that string data to char array.

Why put it in a String in the first place when you could put it straight into an array of chars ?

The serial input basics tutorial shows ways to read serial data into a string (null terminated character array) without blocking (readStringUntil() blocks).

Example #5 shows how to parse data from the serial input.

serialString.jpg
serialString2.jpg

How to post images.