I\'m a novice programmer, but usually I can unravel my own issues. This time I solved the issue, but it still stumps me. A friend suggested I ask this community for input.>
C strings are null terminated. If you have 2 characters ("10" for example) you need a buffer sized 2 + 1 for the null terminator.
sprintf()
adds this to the end of your buffer; in your current case you actually have a buffer overflow because you're not providing enough space.
The modern, safer approach is to use snprintf()
to which you supply the length of the buffer.