How to know if i'm under dos,windows or linux ?

General FreeBASIC programming questions.
Post Reply
DjPoke
Posts: 6
Joined: Dec 02, 2005 1:33
Location: Corsica (France)

How to know if i'm under dos,windows or linux ?

Post by DjPoke »

Hello ! :-)

I'm making a free multiplateform "gui/tools". But for my gui to run specific tools, i need to know in what o.s i'm.

I know i can detect linux with the chdir command with something like that :

chdir "\"
if ucase$(mid$(curdir$,1,1))>="A" and ucase$(mid$(curdir$,1,1))<="Z" then ... i'm not under linux

But i don't know how to find the difference between dos32 and win32.

An idea ?
Sterling Christensen
Posts: 142
Joined: May 27, 2005 6:13

Post by Sterling Christensen »

There are defines you can use.

Code: Select all

#ifdef __FB_LINUX__
    PRINT "Hello, Linux!"
#elseif defined(__FB_DOS__)
    PRINT "Hello, DOS!"
#elseif defined(__FB_WIN32__)
    PRINT "Hello, Windows!"
#endif
DjPoke
Posts: 6
Joined: Dec 02, 2005 1:33
Location: Corsica (France)

Post by DjPoke »

Thanks a lot ! :-)
Post Reply