CRT Features in Visual C++ 2005
This topic contains a list of new CRT features in Visual C++ 2005.
CRT
Breaking Changes
New features
Secure versions of several functions have been added. These functions handle errors in a better way and enforce stricter controls on buffers to help avoid common security flaws. The new secure versions are identified by the _s suffix.
Existing less secure versions of many functions have been deprecated. To disable the deprecation warnings, define _CRT_SECURE_NO_WARNINGS. For more information, see Security-Enhanced Versions of CRT Functions.
Many existing functions now validate their parameters and invoke the invalid parameter handler when an invalid parameter is passed. For more information, see the individual function references and the Parameter Validation topic.
Many existing functions now set errno where they did not before. See individual function references for specific errno information.
The typedef errno_t with type integer was added. errno_t is used whenever a function return type or parameter deals with error codes from errno. errno_t replaces errcode.
Locale-dependent functions now have versions which take the locale as a parameter rather than using the current locale. These new functions have the _l suffix. Several new functions were added to work with locale objects. New functions include _get_current_locale, _create_locale and _free_locale. See individual function references for more information.
New functions were added to support locking and unlocking file handles. For more information, see _lock_file and _unlock_file.
The _spawn family of functions does not reset errno to zero on success, as it did in previous versions. For more information, see _spawn, _wspawn Functions.
Versions of the printf family of functions that allow you to specify the order in which the arguments are used are available. See printf_p Positional Parameters, _cprintf_p, _cprintf_p_l, _cwprintf_p, _cwprintf_p_l, _printf_p, _printf_p_l, _wprintf_p, _wprintf_p_l, _sprintf_p, _sprintf_p_l, _swprintf_p, _swprintf_p_l, _fprintf_p, _fprintf_p_l, _fwprintf_p, _fwprintf_p_l, _vprintf_p, _vprintf_p_l, _vwprintf_p, _vwprintf_p_l, _vsprintf_p, _vsprintf_p_l, _vswprintf_p, _vswprintf_p_l, and _vfprintf_p, _vfprintf_p_l, _vfwprintf_p, _vfwprintf_p_l.
Unicode is now a supported text format. The function _open supports _O_TEXTW, _O_UTF8 and _O_UTF16 attributes. The fopen function supports the "ccs=ENCODING" method of specifying a Unicode format. For more information, see _open, _wopen and fopen, _wfopen and fopen_s, _wfopen_s.
A new version of the CRT libraries built in managed code (MSIL) is now available and is used when compiling with the /clr (Common Language Runtime Compilation) option. See C Run-Time Libraries for more information.
_fileinfo has been removed.
The default size for time_t is now 64 bits, which expands the range of time_t and several of the time functions out to the year 3000. See Time Management, and the individual time functions.
The CRT now supports setting the locale on a per thread basis. The function _configthreadlocale was added to support this feature.
The _statusfp2 and __control87_2 functions were added to allow access to and control of the floating point control word on both the x87 and SSE2 floating point processor.
The_mkgmtime and _mkgmtime64 functions were added to provide support for converting times (struct tm) to Greenwich Mean Time (GMT).
Changes were made to swprintf and vswprintf to better conform with the standard. For more information, see sprintf, _sprintf_l, swprintf, _swprintf_l, __swprintf_l.
A new header file, INTRIN.H, provides prototypes for some intrinsic functions.
The fopen function now has an N attribute.
The _open function now has an _O_NOINHERIT attribute.
The atoi function now returns INT_MAX and sets errno to ERANGE on overflow. In previous versions, the overflow behavior was undefined.
The printf family of functions supports hexadecimal floating point output implemented according to the ANSI C99 standard using the format type specifiers %a and %A. For more information, see printf Type Field Characters.
The printf family now supports the "ll" (long long) size prefix. For more information, see Size Specification.
The _controlfp function has been optimized for better performance.
Debug versions of some functions have been added. For more information, see _strdup_dbg, _wcsdup_dbg, _tempnam_dbg, _wtempnam_dbg, _getcwd_dbg, _wgetcwd_dbg, _getdcwd_dbg, _wgetdcwd_dbg,_fullpath_dbg, _wfullpath_dbg.
Added _chgsignl and _cpysignl (long double versions).
Added _locale_t type to type table.
New macro _countof Macro added for computing number of elements in an array.
In each function topic, a section on .NET Framework equivalents has been added.
Several string functions now have the option of truncating strings rather than failing when output buffers are too small; see _TRUNCATE.
_set_se_translator now requires the use of the /EHa compiler option.
fpos_t is now __int64 under /Za (for C code) and when __STDC__ is set manually (for C++ code). It used to be a struct.
_CRT_DISABLE_PERFCRIT_LOCKS can improve the I/O performance of single-threaded programs.
POSIX names have been deprecated in favor of ISO C++ conformant names (for example, use _getch rather than getch).
New link options .obj files are available for pure mode. See Link Options for more details.