From: Simon Wright <simon@pushface.org>
Subject: Re: How to find the type of operating system.
Date: Thu, 07 Apr 2016 07:45:40 +0100
Date: 2016-04-07T07:45:40+01:00 [thread overview]
Message-ID: <lyoa9ludbf.fsf@pushface.org> (raw)
In-Reply-To: 533e9e24-e8b6-42e0-b80c-10eae266ee64@googlegroups.com
Anh Vo <anhvofrcaus@gmail.com> writes:
> On Wednesday, April 6, 2016 at 2:41:33 PM UTC-7, Randy Brukardt wrote:
>> "ldries46" <bertus.dries@planet.nl> wrote in message
>> news:57053167$0$4216$e4fe514c@news.kpn.nl...
>> > How can I fin in which operating system a program runs and other details
>> > of that operating system.
>>
>> Ada has System.System_Name provides an implementation-defined indication of
>> the name of the target, but that often isn't set in any useful way. (Dunno
>> what GNAT does with it, if anything.)
>
> With GNAT, I managed to make it work for Windows and Linux/Unix not long ago.
>
> Dir_Separator : Character;
> pragma Import (C, Dir_Separator, "__gnat_dir_separator");
> --...
> Put_Line ("The program is run on OS: => " &
> (if Dir_Separator = '\' then "Windows" else "Unix/Linux"));
GNAT.OS_Lib.Directory_Separator provides exactly this functionality.
next prev parent reply other threads:[~2016-04-07 6:45 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-06 15:55 How to find the type of operating system ldries46
2016-04-06 21:41 ` Randy Brukardt
2016-04-06 22:42 ` Anh Vo
2016-04-07 6:45 ` Simon Wright [this message]
2016-04-07 7:31 ` Randy Brukardt
2016-04-07 16:33 ` Jeffrey R. Carter
2016-04-07 11:20 ` Lucretia
2016-06-24 21:12 ` Victor Porton
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox