On 01/26/2011 05:55 PM, Pierre Pronchery wrote:
On 01/25/2011 16:34, Holger Hans Peter Freyther
wrote:
2.) snprintf will not add a '\0' of optarg is of the length of 32 or longer
Actually it does, even though it may truncate the resulting string in
the process:
« snprintf() and vsnprintf() will write at most size-1 of the
characters printed into the output string (the size'th character
then gets the terminating `\0') »
The trailing null byte won't be added to str, if the string is truncated.
from man snprintf on a Linux machine.