I have a project which uses _vscwprintf()
/vswprintf()
(via _vsctprintf()
/_vstprintf()
) to create formatted strings of arbitrary length in malloc()
ed buffers.
When I started the project under Visual C++ 2008, _vstprintf()
took three parameters:
int vswprintf(wchar_t * _String, const wchar_t * _Format, va_list _Ap)
But after leaving my project for some time when I came back to it with Visual C++ 2012, I've found that MS has changed the function to take four parameters:
int vswprintf(wchar_t * _String, size_t _Count, const wchar_t * _Format, va_list _Ap)
I would like my code to be buildable under Visual C++ 2008, 2010, and 2012 (it's portable to Linux and Solaris too).
Is there some symbol I can check for with #ifdef
so that I can build correctly with the 3-parameter or 4-parameter version of the function?
I assume there is a symbol that tells me which version of Visual C++ I'm compiling under, but is this the correct way to do it? For instance is there some possibility that a newer compiler could build with an older C library or runtime, or vice versa?
My code is actually using C rather than C++ if that makes a difference.