Character array gets messed up when I "examine" it in my code

You're using atoi, but I can't see where you're terminating the string.
inData is too small, I think.