Thread: Enviroment Function

  1. #1
    Newbeer ch4's Avatar
    Join Date
    Jan 2007

    Enviroment Function

    I would like to know if there is a function in order to understand if the program runs over Windows or Unix ?


  2. #2
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Not really. See, Unix and Windows have quite different APIs, so in general, if you actually need any platform-specific functionality, you have to make the distinction at compile time anyway.
    Furthermore, Unix and Windows use different executable formats, so you need the distinction at compile time even for programs relying only on the standard library.

    So there's really no point in finding this out at runtime.
    All the buzzt!

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  3. #3
    and the hat of sweating
    Join Date
    Aug 2007
    Toronto, ON
    If you can execute a program on Windows, it's running on Windows; if you can execute it on UNIX, it's running on UNIX. You cannot run a program on multiple platforms. For that you need something like Java.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Seg Fault in Compare Function
    By tytelizgal in forum C Programming
    Replies: 1
    Last Post: 10-25-2008, 03:06 PM
  2. Another syntax error
    By caldeira in forum C Programming
    Replies: 31
    Last Post: 09-05-2008, 01:01 AM
  3. In over my head
    By Shelnutt2 in forum C Programming
    Replies: 1
    Last Post: 07-08-2008, 06:54 PM
  4. Replies: 28
    Last Post: 07-16-2006, 11:35 PM
  5. const at the end of a sub routine?
    By Kleid-0 in forum C++ Programming
    Replies: 14
    Last Post: 10-23-2005, 06:44 PM