DosVersion function
Current OS version.
Declaration
function DosVersion: WordDescription
DosVersion returns the operating system or kernel version. The
low byte contains the major version number, while the high byte
contains the minor version number.
On systems where versions consists of more then two numbers,
only the first two numbers will be returned. For example Linux version 2.1.76
will give you DosVersion 2.1. Some operating systems, such as FreeBSD, do not
have system calls to return the kernel version, in that case a value of 0 will
be returned.
Errors
None.
Example: ex1
Program Example1;
uses Dos;
{ Program to demonstrate the DosVersion function. }
var
OS : string[32];
Version : word;
begin
{$IFDEF LINUX}
OS:='Linux';
{$ENDIF}
{$ifdef FreeBSD}
OS:='FreeBSD';
{$endif}
{$ifdef NetBSD}
OS:='NetBSD';
{$endif}
{$ifdef Solaris}
OS:='Solaris';
{$endif}
{$ifdef QNX}
OS:='QNX';
{$endif}
{$IFDEF DOS}
OS:='Dos';
{$ENDIF}
Version:=DosVersion;
WriteLn('Current ',OS,' version is ',Lo(Version),'.',Hi(Version));
end.An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
