#include <stdio.h>int sprintf(char *buf, const char *format, ...);

The sprintf( ) function is identical to printf( ) except that the output is put into the array pointed to by buf instead of being written to the stdout. The array pointed to by buf is null-terminated. See printf( ).

In C99, buf and format are qualified by restrict.

The return value is equal to the number of characters actually placed into the array.

It is important to understand that sprintf( ) provides no bounds checking on the array pointed to by buf. This means that the array will be overrun if the output generated by sprintf( ) is greater than the array can hold. See snprintf( ) for an alternative.

Related functions are printf( ) and fsprintf( ).

C(s)C++ Programmer's Reference
C Programming on the IBM PC (C Programmers Reference Guide Series)
ISBN: 0673462897
EAN: 2147483647
Year: 2002
Pages: 539 © 2008-2017.
If you may any questions please contact us: