Global Variables

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at Global Variables.

The Microsoft C run-time library provides the following global variables or macros. Several of these global variables or macros have been deprecated in favor of more-secure functional versions, which we recommend you use instead of the global variables.

VariableDescription
__argc, __argv, __wargvContains the command-line arguments.
_daylight, _dstbias, _timezone, and _tznameDeprecated. Instead, use _get_daylight, _get_dstbias, _get_timezone, and _get_tzname.

Adjusts for local time; used in some date and time functions.
errno, _doserrno, _sys_errlist, and _sys_nerrDeprecated. Instead, use _get_errno, _set_errno, _get_doserrno, _set_doserrno, perror and strerror.

Stores error codes and related information.
_environ, _wenvironDeprecated. Instead, use getenv_s, _wgetenv_s, _dupenv_s, _wdupenv_s, _putenv_s, and _wputenv_s.

Pointers to arrays of pointers to the process environment strings; initialized at startup.
_fmodeDeprecated. Instead, use _get_fmode or _set_fmode.

Sets default file-translation mode.
_iobArray of I/O control structures for the console, files, and devices.
_pctype, _pwctype, _wctype, _mbctype, _mbcasemapContains information used by the character-classification functions.
_pgmptr, _wpgmptrDeprecated. Instead, use _get_pgmptr or _get_wpgmptr.

Initialized at program startup to the fully-qualified or relative path of the program, the full program name, or the program name without its file name extension, depending on how the program was invoked.

C Run-Time Library Reference
Global Constants
__argc, __argv, __wargv
_get_daylight
_get_dstbias
_get_timezone
_get_tzname
perror
strerror
_get_doserrno
_set_doserrno
_get_errno
_set_errno
_dupenv_s, _wdupenv_s
getenv, _wgetenv
getenv_s, _wgetenv_s
_putenv, _wputenv
_putenv_s, _wputenv_s
_get_fmode
_set_fmode

Show: