// wvsprintf001.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
//
#include "stdafx.h"
void __cdecl test(LPCSTR format,...)
{
TCHAR buf[2048];
memset(buf,'!',sizeof(buf)/sizeof(TCHAR)-1);
buf[2047] = '\0';
printf( "before buf[1024]=%d\n", buf[1024] );
printf( "before buf[1025]=%d\n", buf[1025] );
wvsprintf( buf, format, (va_list)((&format)+1));
printf( "after buf[1024]=%d\n", buf[1024] );
printf( "after buf[1025]=%d\n", buf[1025] );
printf( "length=%d\n", strlen(buf) );
printf( "result=%s\n", buf );
}
int _tmain(int argc, _TCHAR* argv[])
{
TCHAR testdata[2048];
for( int i=0; i<sizeof(testdata)/sizeof(TCHAR)-1; i++ )
{
testdata[i] = (i % 26) + 'A';
}
testdata[2047] = '\0';
test("Start %s end",testdata);
return 0;
}