This repository has been archived on 2024-12-16. You can view files and clone it, but cannot push or open issues or pull requests.
CodeBlocksPortable/WATCOM/samples/clibexam/vsnprint.c

27 lines
428 B
C
Raw Normal View History

#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 );
}