@node _get_dos_version, misc @findex _get_dos_version @subheading Syntax @example #include extern unsigned short _osmajor, _osminor; extern unsigned short _os_trueversion; extern const char * _os_flavor; unsigned short _get_dos_version(int true_version); @end example @subheading Description This function gets the host OS version and flavor. If the argument @var{true_version} is non-zero, it will return a @cite{true} version number, which is unaffected by possible tinkering with SETVER TSR program. (This is only available in DOS 5.0 or later.) The external variables @code{_osmajor} and @code{_osminor} will always be set to the major and minor parts of the @cite{advertised} version number. The external variable @code{_os_trueversion} will always be set to the true version number. @code{_osmajor}, @code{_osminor} and @code{_os_trueversion} may possibly be changed by @code{SETVER}, even if @var{true_version} is non-zero. You typically need the true version when you need an intimate knowledge of the host OS internals, like when using undocumented features. Note that some DOS clones (notably, DR-DOS) do not support DOS function required to report the true DOS version; for these, the version reported might be affected by @code{SETVER} even if @var{true_version} is non-zero. The external variable @code{_os_flavor} will point to a string which describes the OEM name of the host OS variety. @subheading Return Value @code{_get_dos_version()} returns the version number (true version number, if @var{true_version} is non-zero) as a 16-bit number: the major part of the version in the upper 8 bits, the minor part in the lower 8 bits. For instance, DOS version 6.20 will be returned as 0x0614. @subheading Portability @portability !ansi, !posix @subheading Example @example unsigned short true_dos_version = _get_dos_version(1); if (true_dos_version < 0x0614) /* require DOS 6.20 or later */ puts("This program needs DOS 6.20 or later to run"); else printf("You are running %s variety of DOS\n", _os_flavor); @end example