Some clarification is needed her.
If you are looking for a way to make your char array a C string, you should just add dta[len] = '\0';
after your while
loop.
You’d have to do this anyway, even for the next step.
If youn want a String
object, than you just need to assign the char array to your String
object like this myStringObj = dta;
.
In addition you have to make sure, that your while() {}
never fills more than 19 characters into your char array, since you need to leave space for the zero-terminator.