Format a character string array.
Compatibility:This function is compatible with the following targets:
|
|
#include <stdio.h>
int snprintf(char * s, size_t n,  
const char * format, ...);
Parameters for this facility are:
For specifications concerning the output control string and conversion specifiers please see: "Output Control String and Conversion Specifiers."
Return: Example Of Snprintf() Usage:#include <stdio.h>
int main()
{
int i = 1;
static char s[] = "Metrowerks";
char dest[50];
int retval;
retval = snprintf(dest, 5, "%s is number %d!", s, i);
printf("n too small, dest = |%s|, retval = %i\n", dest, retval);
retval = snprintf(dest, retval, "%s is number %d!", s, i);
printf("n right size, dest = |%s|, retval = %i\n", dest, retval);
return 0;
}
Output:
n too small, dest = |Metr|, retval = 23
n right size, dest = |Metrowerks is number 1|, retval = 23
[ First ] [ Previous ] [ Next ] [ Last ] [ Manuals ]
Visit the Metrowerks website at: http://www.metrowerks.com
For assistance contact Metrowerks Technical Support at: cw_support@metrowerks.com
Copyright © 2000, Metrowerks Corp. All rights reserved.
Last updated: August 16, 2000