|
// sprintf.cpp
// based on:
// LIBCTINY - Matt Pietrek 2001
// MSDN Magazine, January 2001
// 08/12/06 (mv)
#include <windows.h>
#include <stdio.h>
#include "libct.h"
#include <cassert>
#define EOF (-1)
// Force the linker to include USER32.LIB
#pragma comment(linker, "/defaultlib:user32.lib")
EXTERN_C int sprintf(char *buffer, const char *format, ...)
{
int retValue;
va_list argptr;
va_start(argptr, format);
retValue = ::wvsprintfA(buffer, format, argptr);
va_end(argptr);
return retValue;
}
EXTERN_C int _snprintf(char *dest, size_t n, const char *fmt, ...)
{
assert( ( n < 1024 ) && "wvsprintf() supports an output buffer with a maximum of 1024 bytes." ); n;
va_list args;
va_start(args, fmt);
int retValue = ::wvsprintfA(dest, fmt, args);
va_end(args);
return retValue;
}
EXTERN_C int _snwprintf(wchar_t *dest, size_t n, const wchar_t *fmt, ...)
{
assert( ( n < 1024 ) && "wvsprintf() supports an output buffer with a maximum of 1024 bytes." ); n;
va_list args;
va_start(args, fmt);
int retValue = ::wvsprintfW(dest, fmt, args);
va_end(args);
return retValue;
}
EXTERN_C int vsnprintf(char *dest, size_t n, const char *fmt, va_list args)
{
assert( ( n < 1024 ) && "wvsprintf() supports an output buffer with a maximum of 1024 bytes." ); n;
return ::wvsprintfA(dest, fmt, args);
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.