Thread: determining environment with C

  1. #1

    Question determining environment with C


    I have to write a little program (for class) which copies files. I set something up using windows.h, pretty simple. However, I'm writing this for use with dos and I want to make sure that dos is available before running the program. This really isn't part of the assignment, but it got me wondering if there is a way (using c) to determine which OS is used.


  2. #2
    train spotter
    Join Date
    Aug 2001
    near a computer
    In MS Dev Studio with a WIN32 app I use

    (used to be GetVersion )

    I don't know if this will be available in DOS.

  3. #3
    Registered User
    Join Date
    Sep 2001
    in stdlib.h there is a function called getenv() which
    can get some environment variables ...
    I suggest to read the man pages of this function.

    Otherwise, try the system() function ...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. (VC++ related) Unicode or Multi-byte environment?
    By PaulBlay in forum C Programming
    Replies: 3
    Last Post: 05-22-2009, 08:42 AM
  2. Replies: 11
    Last Post: 02-18-2009, 06:10 AM
  3. Setting environment variables for use outside program
    By guesst in forum Windows Programming
    Replies: 12
    Last Post: 09-09-2008, 12:53 PM
  4. Draw distance through environment mapping
    By VirtualAce in forum Game Programming
    Replies: 1
    Last Post: 05-14-2006, 11:52 AM
  5. Setting OS Environment Variables
    By ImNotMad in forum C Programming
    Replies: 4
    Last Post: 10-23-2003, 02:07 AM