Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7975381
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T08:37:33+00:00 2026-06-04T08:37:33+00:00

In the example of my computer the desired output should be: C: E: F:

  • 0

In the example of my computer the desired output should be: “C: E: F: H: N:” . I know it’s possible, but what is the simpliest way to do that? Pottering in QueryDosDevice output

#ifndef UNICODE
#define UNICODE
#endif


#include <Windows.h>
#include <fstream>
#include <iostream>

const int REPORT_LENGTH = 5000;

int main(void)
{
    TCHAR targetPath[REPORT_LENGTH];

    std::ofstream oFile;

    oFile.open("dos device query.txt");

    QueryDosDevice(NULL,targetPath,REPORT_LENGTH);

    for(int i=0; i<REPORT_LENGTH;i++)
    if (targetPath[i]=='\0')(targetPath[i]='\n');



    for(int i=0; i<REPORT_LENGTH; i++)
    oFile<<static_cast<char>(targetPath[i]);

    oFile.close();

    return 0;
}

would be a huge waste of time and resources. Also function GetLogicalDriveStrings has betrayed me a lot.

#include <Windows.h>

int main()
{
    TCHAR buffer[50];

    GetLogicalDriveStrings(50,buffer);

    MessageBox(0,buffer,"Drives in the system",MB_OK); 


    return 0;
}

It shows only the “C:\” volumine.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T08:37:34+00:00Added an answer on June 4, 2026 at 8:37 am

    Example with GetLogicalDrives, albeit not with concatenating to a string (which is left as an exercise to the OP and the readers ;)):

    #include <stdio.h>
    #include <tchar.h>
    #include <Windows.h>
    
    int __cdecl _tmain(int argc, _TCHAR *argv[])
    {
        // Get the bit mask of drive letters
        DWORD drives = ::GetLogicalDrives();
        // Go through all possible letters from a to z
        for(int i = 0; i < 26; i++)
        {
            // Check if the respective bit is set
            if(drives & (1 << i))
            {
                // ... and if so, print it
                _tprintf(TEXT("Drive %c: exists\n"), _T('A') + i);
            }
        }
        return 0;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

It is possible that this problem doesn't display on your computer. A working example
Is it possible to load image to XNA game from user computer? For example,
i've got following example xml: <entity id=1> <name>computer</name> <type>category</type> <entities> <entity id=2> <name>mac</name> <type>category</type>
Is it possible to directly compute the product (or for example sum) of two
Possible Duplicate: Python, compute list difference I have two lists For example: A =
Example: I have an class that inherits from UIImageView. An object creates an instance
My computer appears to store ints in bigendian order. For example 0xFF440022 is 4
For example if in a textbox that is full of many different part numbers
Our computer science teacher once said that for some reason it is faster to
For example, if I do time.sleep(100) and immediately hibernate my computer for 99 seconds,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.