Thread: Get windows directory

  1. #1
    Registered User
    Join Date
    Mar 2006

    Get windows directory

    How can I find out the windows directory using c++? I know it's usually C:\WINDOWS\ however what if the root drive is D, or even the path is different (E:\MyWINDOWS?).

    I'm just curious if theres a function like GetEnvironmentVariable ( "%WINDOWSDIR", str ) which would put the value into str or whatever.



  2. #2
    Join Date
    Oct 2007
    It's easy with Win32 API.
    All you would do is call GetWindowsDirectory!
    Good luck. Reply if you have any troubles.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  3. #3
    Registered User
    Join Date
    Mar 2006
    lol. Thanks!

  4. #4
    Registered User
    Join Date
    Apr 2007
    You should learn how to search first, for so newbies questions...
    The first link for "windows directory"
    gives the answer on Google Groups in win32 api newsgroup
    and it was in 1999...
    Last edited by Alex31; 07-05-2008 at 05:22 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Profiler Valgrind
    By afflictedd2 in forum C++ Programming
    Replies: 4
    Last Post: 07-18-2008, 09:38 AM
  2. accessing all files in a folder.
    By pastitprogram in forum C++ Programming
    Replies: 15
    Last Post: 04-30-2008, 10:56 AM
  3. Couple errors please help :-D
    By JJJIrish05 in forum C Programming
    Replies: 9
    Last Post: 03-06-2008, 01:54 AM
  4. Replies: 6
    Last Post: 07-30-2003, 03:08 AM
  5. Menu Item Caption - /a for right aligned Accelerator?
    By JasonD in forum Windows Programming
    Replies: 6
    Last Post: 06-25-2003, 11:14 AM