Converting char array to string constructs blank string sometimes

I’m running a loop in which I place data into a char array buffer, then convert it to a string and pass it to a function.

This seems to work the first 7 times through the loop, but on the 8th time, the string comes out blank.

With print statements, I’m able to see that the buffer contains the values that it should all the way up until the point where I convert it to a string (place it in a string constructor).

Since it doesn’t happen every time, I don’t know what could possibly be wrong. Any advice?

Strip down your code to a bare minimum that shows that behaviour and show it.
Just guessing possible reasons without seeing the code is unreasonable :wink:


I have stripped it down immensely. I’m not sure what to do at this point. Has noone else experienced this ever?

Hi @bgenchel

If you post your code here in the forum, we can help you debug it. There is no reason for this happen other than a bug in your code.

If you enclose to code like this it will get formatted nicely:

    <code goes here>