Get windows directory

This is a discussion on Get windows directory within the Windows Programming forums, part of the Platform Specific Boards category; How can I find out the windows directory using c++? I know it's usually C:\WINDOWS\ however what if the root ...

  1. #1
    Registered User
    Join Date
    Mar 2006
    Location
    USA::Colorado
    Posts
    155

    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.

    Thanks,

    Matt
    ~guitarist809~

  2. #2
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,621
    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
    Location
    USA::Colorado
    Posts
    155
    lol. Thanks!
    ~guitarist809~

  4. #4
    Registered User
    Join Date
    Apr 2007
    Posts
    137
    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
    http://groups.google.com/group/comp....dans+ce+groupe
    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

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