Quantcast
Channel: Visual C forum
Viewing all articles
Browse latest Browse all 15302

[Visual C++] Crash when using _vstprintf_s. Is there a bug?

$
0
0

Hi Guys,

I'm facing with issue in function _vstprintf_s.

I has written a simple program like below:

#include "stdafx.h"
#include <stdio.h>
#include "afx.h"

CString TestVSPrintf(const CString &msgFormat, ...){
	TCHAR buffer[256] = {0};
	va_list argprt;
	va_start(argprt, msgFormat);
	_vstprintf_s(buffer, 255, msgFormat, argprt);
	va_end(argprt);
	return buffer;
}

int _tmain(int argc, _TCHAR* argv[])
{
	CString d = TestVSPrintf("String: %s", "TestString");
	return 0;
}

It crashes while coming to line _vstprintf_s with bad pointer (0xcccccccc) access violation error.

I'm using Visual Studio 2005 SP1.

Are there any known issue?


Viewing all articles
Browse latest Browse all 15302

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>