4.14.4. snprintf()

snprintf() worksalmost exactly like the ANSI sprintf() function, except that the caller can specify the maximum size of the buffer. The return value is the length of the complete formatted string that would have been written if the buffer were big enough. Therefore, the string written into the buffer is complete only if the return value is at least zero and at most n-1.

The bufsize parameter specifies the number of characters of buffer that the function can write into, including the terminating null.

<stdio.h> is an ANSI header file, but the function is not allowed by the ANSI C library standard. It is therefore not available if you use the compilers with the -strict option.

Syntax

int snprintf(char *buffer, size_t bufsize, const char *format,  ...);

Copyright © 1999-2001 ARM Limited. All rights reserved.ARM DUI 0067D
Non-Confidential