Forum Discussion
Altera_Forum
Honored Contributor
15 years agoWhen using the standard C library functions (such as printf), all strings must end with a zero, or null terminator character. If there is a zero byte in your integer, only what is before that will be considered part of the string.
Trying to display an integer with the "%s" format will give somewhat unpredictable results depending on the endianness of the architecture and what happens to be in memory after the integer. You are probably better off converting the integer to individual bytes and using the "%c" format specifier or converting all your data to a proper string (character array with null terminator).