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.
_os... Global Variables
◄Up► ◄Contents► ◄Index► ◄Back►
────────────────────────────────────────────────────────────────────────────
Variable: _osmajor, _osminor, _osmode, _osversion
Include: <stdlib.h>
<dos.h> (_osversion only)
Syntax: extern unsigned char _near _cdecl _osmajor;
extern unsigned char _near _cdecl _osminor;
extern unsigned char _near _cdecl _osmode;
extern unsigned _near _cdecl _osversion;
The _osmajor and _osminor variables specify the version number of
DOS or OS/2 currently in use. They are declared in STDLIB.H. The
_osversion variable, declared in DOS.H, provides the complete
version number. The _osmajor variable holds the major version
number, and the _osminor variable stores the minor version number.
Thus, under DOS version 3.20, _osmajor is 3 and _osminor is 20.
These variables are useful when you want a program to run on
different versions of DOS. 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 whether your program is running in
real mode (DOS) or protected mode (OS/2). It contains the constant
value DOS_MODE if the program is running in real mode, or OS2_MODE
if it is running in protected mode.