We have a legacy project which was built in Visual Studio 2003.NET. Still work fine, but we're in the process of migrating it to Visual Studio 2019. Surprisingly few issues so far, though lots of warnings. One warning relates to fopen:
warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead.
Converting this to fopen_s in VS2019 is trivial, but this doesn't build in Visual Studio 2003.NET (because fopen_s is not a recognised keyword). This can be solved with code like this:
#if (_MSC_VER <= 1310)
// Visual Studio 2003.NET or earlier
FILE* fp = fopen(pszTXT, "w");
#elif (_MSC_VER > 1310)
// Newer versions of Visual Studio
FILE* fp = NULL;
fopen_s(&fp, pszTXT, "w");
#endif
When was fopen_s introduced into Visual Studio? The MSDN link was not immediately clear.
The question is intended to be general, not specific to fopen_s => is there documentation which shows which version of Visual Studio a keyword or method was introduced (or made obsolete).