2 Copyright © 1995-2003, The AROS Development Team. All rights reserved.
5 ANSI C function snprintf().
8 /*****************************************************************************
22 Formats a list of arguments and writes them into the string str.
25 str - The formatted string is written into this variable. You
26 must make sure that it is large enough to contain the
28 n - At most n characters are written into the string. This
30 format - Format string as described above
31 ... - Arguments for the format string
34 The number of characters written into the string. If this is
35 -1, then there was not enough room. The 0 byte at the end is not
45 fprintf(), vprintf(), vfprintf(), snprintf(), vsprintf(),
50 ******************************************************************************/
55 va_start (args
, format
);
57 retval
= vsnprintf (str
, n
, format
, args
);
67 int main (int argc
, char ** argv
)
72 printf ("snprintf test\n");
74 rc
= snprintf (buffer
, sizeof (buffer
), "%10d", 5);
76 if (rc
< sizeof (buffer
))
77 printf ("rc=%d, buffer=\"%s\"\n", rc
, buffer
);
79 printf ("rc=%d\n", rc
);
81 rc
= snprintf (buffer
, sizeof (buffer
), "%11d", 5);
83 if (rc
< sizeof (buffer
))
84 printf ("rc=%d, buffer=\"%s\"\n", rc
, buffer
);
86 printf ("rc=%d\n", rc
);