CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Jan 2008
    Location
    India
    Posts
    780

    System Drive Path.

    Hi all,

    please tell me how can i get system drive path.

    thanks in advance.
    IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH

  2. #2
    Join Date
    Jan 2008
    Posts
    48

    Re: System Drive Path.

    By searching 1 second in Google Groups :
    http://groups.google.fr/group/comp.o...e5de2ea4e9c4f4

  3. #3
    Join Date
    Feb 2009
    Location
    India
    Posts
    444

    Re: System Drive Path.

    You either want the system drive or the system path!!!

    Use GetWindowsDirectory or GetSystemDirectory and parse the returned string according to your requirement.
    «_Superman
    I love work. It gives me something to do between weekends.

    Microsoft MVP (Visual C++)

  4. #4
    Join Date
    Oct 1999
    Location
    ks
    Posts
    524

    Re: System Drive Path.

    if you mean that you want an executable to determine what directory it is working under at run time you can search the c++ help utility for the
    function that gets the working directory - the name escapes me right now

  5. #5
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,244

    Re: System Drive Path.

    Quote Originally Posted by jim enright View Post
    if you mean that you want an executable to determine what directory it is working under at run time you can search the c++ help utility for the
    function that gets the working directory - the name escapes me right now
    Before searching in the help system just note that system directory (asked by OP) is not the same as the application working directory which you are suggesting to find.
    Ovidiu
    "When in Rome, do as Romans do."
    My latest articles: https://codexpertro.wordpress.com/

  6. #6
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,244

    Re: System Drive Path.

    And here is an example

    Code:
    CString CFoo::GetSystemDrive()
    {
       CString strSystemDrive;
       ::GetSystemDirectory(strSystemDrive.GetBufferSetLength(_MAX_PATH), _MAX_PATH);
       strSystemDrive.ReleaseBuffer();
       return strSystemDrive.Left(2);
    }
    Ovidiu
    "When in Rome, do as Romans do."
    My latest articles: https://codexpertro.wordpress.com/

  7. #7
    Join Date
    Jan 2008
    Location
    India
    Posts
    780

    Re: System Drive Path.

    Thanks
    IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured