C Language and Libraries Help (clang.hlp) (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
Operating System and CPU Global Variables
 Example                                   Up Contents Index Back
─────Run-Time Library───────────────────────────────────────────────────────
 
  Variable:  _osmajor, _osminor, _osmode, _osversion, _cpumode
 
  Include:   <stdlib.h>
             <dos.h>     (_osversion only)
 
  Syntax:    extern unsigned char _osmajor;
             extern unsigned char _osminor;
             extern unsigned char _osmode;
             extern unsigned char _cpumode;
             extern unsigned int  _osversion;
 
     The _osmajor, _osminor, and _osversion variables specify the
     version number of DOS or Windows in use. The _osmajor variable
     holds the "major" version number, and the _osminor variable
     stores the "minor" version number. Thus, under DOS version 5.0,
     _osmajor is 5 and _osminor is 0. The _osversion variable holds
     both values: its low byte contains the major version number and
     its high byte contains the minor version number.
 
     These variables are useful for creating programs that run in
     different versions of DOS and Windows. For example, you can test
     the _osmajor variable before making a call to _sopen; if the
     major version number is earlier (less) than 3, _open should be
     used instead of _sopen.
 
     The _osmode variable indicates the currently running operating
     system: _DOS_MODE, which is defined as 0, and _WIN_MODE, which is
     defined as 2.
     See: _DOS_MODE, _WIN_MODE
 
     The _cpumode variable indicates the mode of the currently running
     operating system: _REAL_MODE, which is defined as 0, and
     _PROT_MODE, which is defined as 2.
     See: _REAL_MODE, _PROT_MODE
                                    -♦-