Advertisement
lutunovoleg

Untitled

Feb 29th, 2024
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.40 KB | None | 0 0
  1. #include <vector>
  2. #include <fileapi.h>
  3. #include <bitset>
  4. #include "drives.h"
  5. std::vector<char> drives() {
  6.     auto bit = std::bitset<32>(GetLogicalDrives());
  7.     std::string tmp = bit.to_string();
  8.     reverse(tmp.begin(), tmp.end());
  9.     std::vector<char> list = {};
  10.     for (int i = 0; i < 32; i++) {
  11.         if (tmp[i] == '1') list.push_back(static_cast<char>('A' + i));
  12.     }
  13.     return list;
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement