27 lines
428 B
C
27 lines
428 B
C
|
|
||
|
#include <stdio.h>
|
||
|
#include <stdarg.h>
|
||
|
#include <string.h>
|
||
|
|
||
|
char msgbuf[80];
|
||
|
|
||
|
char *fmtmsg( char *format, ... )
|
||
|
{
|
||
|
va_list arglist;
|
||
|
|
||
|
va_start( arglist, format );
|
||
|
strcpy( msgbuf, "Error: " );
|
||
|
_vsnprintf( &msgbuf[7], 80-7, format, arglist );
|
||
|
va_end( arglist );
|
||
|
return( msgbuf );
|
||
|
}
|
||
|
|
||
|
void main()
|
||
|
{
|
||
|
char *msg;
|
||
|
|
||
|
msg = fmtmsg( "%s %d %s", "Failed", 100, "times" );
|
||
|
printf( "%s\n", msg );
|
||
|
}
|
||
|
|