Compartir a través de


Deprecated CRT Functions

Deprecated CRT functions and their recommended replacements.

Deprecated POSIX functions

The following POSIX names for functions are deprecated. In most cases, prepending an underscore character gives the standard equivalent name. Note that some functions have more secure versions ("_s" suffix).

You can also eliminate POSIX deprecation warnings by defining _CRT_NONSTDC_NO_DEPRECATE.

Deprecated function

Replacement function

access

_access, _access_s

cabs

_cabs

cgets

_cgets, _cgets_s

chdir

_chdir

chmod

_chmod

chsize

_chsize, _chsize_s

close

_close

cprintf

_cprintf, _cprintf_s

cputs

_cputs

creat

_creat

cscanf

_cscanf, _cscanf_s

cwait

_cwait

dup

_dup

dup2

_dup2

ecvt

_ecvt, _ecvt_s

eof

_eof

execl

_execl

execle

_execle

execlp

_execlp

execlpe

_execlpe

execv

_execv

execve

_execve

execvp

_execvp

execvpe

_execvpe

fcloseall

_fcloseall

fcvt

_fcvt, _fcvt_s

fdopen

_fdopen

fgetchar

_fgetchar

filelength

_filelength

fileno

_fileno

flushall

_flushall

fputchar

_fputchar, _fputwchar

gcvt

_gcvt, _gcvt_s

getch

_getch

getche

_getche

getcwd

_getcwd, _wgetcwd

getpid

_getpid

getw

_getw

hypot

_hypot

inp

_inp

inpw

_inpw

isascii

__isascii

isatty

_isatty

iscsym

__iscsym

iscsymf

__iscsymf

itoa

_itoa, _itoa_s

j0

_j0

j1

_j1

jn

_jn

kbhit

_kbhit

lfind

_lfind, _lfind_s

locking

_locking

lsearch

_lsearch, _lsearch_s

lseek

_lseek

ltoa

_ltoa, _ltoa_s

memccpy

_memccpy

memicmp

_memicmp

mkdir

_mkdir

mktemp

_mktemp, _mktemp_s

open

_open

outp

_outp

outpw

_outpw

putch

_putch

putenv

_putenv, _putenv_s

putw

_putw

read

_read

rmdir

_rmdir

rmtmp

_rmtmp

setmode

_setmode

sopen

_sopen, _sopen_s

spawnl

_spawnl

spawnle

_spawnle

spawnlp

_spawnlp

spawnlpe

_spawnlpe

spawnv

_spawnv

spawnve

_spawnve

spawnvp

_spawnvp

spawnvpe

_spawnvpe

strcmpi

_stricmp

strdup

_strdup

stricmp

_stricmp

strlwr

_strlwr, _strlwr_s

strnicmp

_strnicmp

strnset

_strnset, _strnset_s

strrev

_strrev

strset

_strset, _strset_s

strupr

_strupr, _strupr_s

swab

_swab

tell

_tell

tempnam

_tempnam

toascii

__toascii

tzset

_tzset

ultoa

_ultoa, _ultoa_s

umask

_umask, _umask_s

ungetch

_ungetch

unlink

_unlink

wcsdup

_wcsdup

wcsicmp

_wcsicmp

wcsicoll

_wcsicoll

wcslwr

_wcslwr, _wcslwr_s

wcsnicmp

_wcsnicmp

wcsnset

_wcsnset, _wcsnset_s

wcsrev

_wcsrev

wcsset

_wcsset, _wcsset_s

wcsupr

_wcsupr, _wcsupr_s

write

_write

y0

_y0

y1

_y1

yn

_yn

Security-enhanced functions

The following functions should be avoided because a more secure version of the function should be used instead. For more information, see Security Enhancements in the CRT.

Deprecated function

Security-enhanced replacement

_alloca

_malloca

asctime

asctime_s

_cgets, _cgetws

_cgets_s, _cgetws_s

_chsize

_chsize_s

_controlfp

_controlfp_s

_creat

_sopen_s

_cscanf

_cscanf_s

_cscanf_l

_cscanf_s_l

ctime

ctime_s

_ctime32

_ctime32_s

_ctime64

_ctime64_s

_cwscanf

_cwscanf_s

_cwscanf_l

_cwscanf_s_l

_ecvt

_ecvt_s

_fcvt

_fcvt_s

fopen

fopen_s

freopen

freopen_s

fscanf

fscanf_s

_fscanf_l

_fscanf_s_l

fwscanf

fwscanf_s

_fwscanf_l

_fwscanf_s_l

_gcvt

_gcvt_s

getenv

getenv_s

gets, _getws

gets_s, _getws_s

gmtime

_gmtime_s

_gmtime32

_gmtime32_s

_gmtime64

_gmtime64_s

_i64toa

_i64toa_s

_i64tow

_i64tow_s

_itoa

_itoa_s

_itow

_itow_s

localtime

_localtime_s

_localtime32

_localtime32_s

_localtime64

_localtime64_s

_ltoa, _ltow

_ltoa_s, _ltow_s

_mbccpy

_mbccpy_s

_mbccpy_l

_mbccpy_s_l

_mbscat

_mbscat_s

_mbscpy

_mbscpy_s

_mbslwr, _mbslwr_l

_mbslwr_s, _mbslwr_s_l

_mbsnbcat, _mbsnbcat_l

_mbsnbcat_s, _mbsnbcat_s_l

_mbsnbcpy, _mbsnbcpy_l

_mbsnbcpy_s, _mbsnbcpy_s_l

_mbsnbset

_mbsnbset_s

_mbsnbset_l

_mbsnbset_s_l

_mbsncat

_mbsncat_s

_mbsncat_l

_mbsncat_s_l

_mbsncpy

_mbsncpy_s

_mbsncpy_l

_mbsncpy_s_l

_mbsnset

_mbsnset_s

_mbsnset_l

_mbsnset_s_l

mbsrtowcs

mbsrtowcs_s

_mbsset

_mbsset_s

_mbsset_l

_mbsset_s_l

_mbstok

_mbstok_s

_mbstok_l

_mbstok_s_l

mbstowcs, _mbstowcs_l

mbstowcs_s, _mbstowcs_s_l

_mbsupr, _mbsupr_l

_mbsupr_s, _mbsupr_s_l

memcpy

memcpy_s

memmove

memmove_s

_mktemp

_mktemp_s

_open

_sopen_s

scanf

scanf_s

_scanf_l

_scanf_s_l

_searchenv

_searchenv_s

setbuf

setvbuf

_snprintf

_snprintf_s

_snprintf_l

_snprintf_s_l

_snscanf

_snscanf_s

_snscanf_l

_snscanf_s_l

_snwprintf

_snwprintf_s

_snwprintf_l

_snwprintf_s_l

_snwscanf

_snwscanf_s

_snwscanf_l

_snwscanf_s_l

_sopen

_sopen_s

_splitpath

_splitpath_s

sprintf

sprintf_s

_sprintf_l

_sprintf_s_l

sscanf

sscanf_s

_sscanf_l

_sscanf_s_l

strcat

strcat_s

strcpy

strcpy_s

_strdate

_strdate_s

strerror, _strerror

strerror_s, _strerror_s

_strlwr, _strlwr_l

_strlwr_s, _strlwr_s_l

strncat, _strncat_l

strncat_s, _strncat_s_l

strncpy, _strncpy_l

strncpy_s, _strncpy_s_l

_strnset

_strnset_s

_strnset_l

_strnset_s_l

_strset

_strset_s

_strset_l

_strset_s_l

_strtime

_strtime_s

strtok

strtok_s

_strtok_l

_strtok_s_l

_strupr, _strupr_l

_strupr_s, _strupr_s_l

swprintf

swprintf_s

_swprintf_l

_swprintf_s_l

swscanf

swscanf_s

_swscanf_l

_swscanf_s_l

tmpfile

tmpfile_s

_ui64toa, _ui64tow

_ui64toa_s, _ui64tow_s

_ultoa, _ultow

_ultoa_s, _ultow_s

_umask

_umask_s

vsnprintf, _vsnprintf, _vsnprintf_l, _vsnwprintf, _vsnwprintf_l

vsnprintf_s, _vsnprintf_s, _vsnprintf_s_l, _vsnwprintf_s, _vsnwprintf_s_l

vsprintf, _vsprintf_l, vswprintf, _vswprintf_l, __vswprintf_l

vsprintf_s, _vsprintf_s_l, vswprintf_s, _vswprintf_s_l

_wasctime

_wasctime_s

_wcreat

_wsopen_s

wcrtomb

wcrtomb_s

wcscat

wcscat_s

wcscpy

wcscpy_s

_wcserror, __wcserror

_wcserror_s, __wcserror_s

_wcslwr, _wcslwr_l

_wcslwr_s, _wcslwr_s_l

wcsncat, wcsncat_l

wcsncat_s, _wcsncat_s_l

_wcsncpy, _wcsncpy_l

wcsncpy_s, _wcsncpy_s_l

_wcsnset, _wcsnset_l

_wcsnset_s, _wcsnset_s_l

wcsrtombs

wcsrtombs_s

_wcsset, _wcsset_l

_wcsset_s_wcsset_s_l

wcstok, _wcstok_l

wcstok_s, _wcstok_s_l

wcstombs, _wcstombs_l

wcstombs_s, _wcstombs_s_l

_wcsupr_l, _wcsupr

_wcsupr_s, _wcsupr_s_l

_wctime, _wctime32, _wctime64

_wctime_s, _wctime32_s, _wctime64_s

wctomb, _wctomb_l

wctomb_s, _wctomb_s_l

_wfopen

_wfopen_s

_wfreopen

_wfreopen_s

_wgetenv

_wgetenv_s

wmemcpy

wmemcpy_s

wmemmove

wmemmove_s

_wmktemp

_wmktemp_s

_wopen

_wsopen_s

_wscanf, _wscanf_l

_wscanf_s, _wscanf_s_l

_wsearchenv

_wsearchenv_s

_wsopen

_wsopen_s

_wsplitpath

_wsplitpath_s

_wstrdate

_wstrdate_s

_wstrtime

_wstrtime_s

Functions with Secure Template Overloads

Some of the functions in the preceding section have secure template overloads which can eliminate deprecation warnings by replacing calls to deprecated functions with calls to the new secure versions of those functions. For more information, see Secure Template Overloads.

Deprecated functions with secure template overloads

_cgets, _cgetws

gets, _getws

_itoa, _i64toa, _ui64toa, _itow, _i64tow, _ui64tow

_ltoa, _ltow

_mbsnbcat, _mbsnbcat_l

_mbsnbcpy, _mbsnbcpy_l

mbsrtowcs

mbstowcs, _mbstowcs_l

_mktemp, _wmktemp

_searchenv, _wsearchenv

_snprintf, _snprintf_l, _snwprintf, _snwprintf_l

sprintf, _sprintf_l, swprintf, _swprintf_l, __swprintf_l

strcat, wcscat, _mbscat

strcpy, wcscpy, _mbscpy

_strdate, _wstrdate

_strlwr, _wcslwr, _mbslwr, _strlwr_l, _wcslwr_l, _mbslwr_l

strncat, _strncat_l, wcsncat, wcsncat_l, _mbsncat _mbsncat_l

strncpy, _strncpy_l, wcsncpy, _wcsncpy_l, _mbsncpy, _mbsncpy_l

_strtime, _wstrtime

_strupr, _strupr_l, _mbsupr, _mbsupr_l, _wcsupr_l, _wcsupr

_ultoa, _ultow

vsnprintf, _vsnprintf, _vsnprintf_l, _vsnwprintf, _vsnwprintf_l

vsprintf, _vsprintf_l, vswprintf, _vswprintf_l, __vswprintf_l

wcrtomb

wcsrtombs

wcstombs, _wcstombs_l

See Also

Concepts

Run-Time Routines by Category