determining environment with C

This is a discussion on determining environment with C within the C Programming forums, part of the General Programming Boards category; howdy, I have to write a little program (for class) which copies files. I set something up using windows.h, pretty ...

  1. #1
    stummies
    Guest

    Question determining environment with C

    howdy,

    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.

    thanks,
    greg

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

    GetVersionEx
    (used to be GetVersion )

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

  3. #3
    Registered User
    Join Date
    Sep 2001
    Posts
    2
    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, 05: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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21