Hi there, I wanto to know wha'ts the best/easy way to know in wich operating system the application is running. I need to know it because I want to execute different instructions depending on the OS...
Hi there, I wanto to know wha'ts the best/easy way to know in wich operating system the application is running. I need to know it because I want to execute different instructions depending on the OS...
use #ifdef WIN32
It tells you that the OS is some windows flavor. Likewise there are macros defined for *nix and mac. But I don't knw the words used for *nix and mac. I think it should be UNIX and MAC
Mithin
www.mithin.in
Dark_Tower (1st May 2006)
The "Assistant" has a topic called:
and under it is another topic:
The second tells you all you need to know, with examples.Qt Code:
Window System Specific NotesTo copy to clipboard, switch view to plain text mode
Dark_Tower (4th May 2006)
There are a couple thing Qt does for you to let you know at compile time what OS you are compiling for. Of course Qt is "Write once, Compile Everywhere". There are some generic defines based on your windowing system like
Q_WS_X11
Q_WS_WIN
Q_WS_MAC
This can narrow things down quite a bit sine you can say if I'm on windows do the win32 thing else do the POSIX thing.
There are some OS specific ones but they are too specific for most applications
Q_OS_IRIX
Q_OS_LINUX
Q_OS_FREEBSD
Q_OS_BSD4
Q_OS_WIN32
These can help you when you want a list of network interface on IRIX etc. Where code varies greatly between very specific OSs.
Of course see Assistant for a full list.
--Justin Noel
justin@ics.com
Dark_Tower (4th May 2006)
you may also have a look at QSysInfo. In combination with these macros it allows you to determine what version of Window$ or Mac OS X are running, which can be useful if your app use a component that is not provided by Win9x but by WinXP...
Current Qt projects : QCodeEdit, RotiDeCode
Bookmarks