9 Years
Discussion Span
Last Post by Salem

The short answer is you can't. The language itself is portable, therefore it works hard to avoid any explicit knowledge of the OS on which it is running.

Take TurboC (an often used, but misplaced example), and your OS is XP. Is your OS
a) DOS
b) The Virtual DOS Machine which XP provides to emulate DOS
c) XP

If you then further complicate it with say running vmware on Linux, which hosts XP as a guest operating system (then all of the above), which OS is your program now running under?

Unless you resort to using OS specific API functions (which pretty much gives the game away), there isn't going to be a standard way which gives you a definitive answer.


I only want to identify whether i m working on a windows based system or a unix based system. Can we do this.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.