C++获取系统盘符极简方法
< 返回列表时间: 2018-09-25来源:OSCHINA
【围观】麒麟芯片遭打压成绝版,华为亿元投入又砸向了哪里?>>>
盘符获取 std::shared_ptr<std::list<wchar_t>> disks(void) { wchar_t data[255]; return [&](int length)->std::shared_ptr<std::list<wchar_t>> { auto result = std::make_shared< std::list<wchar_t>>(); std::wstring disk = L"ABCDEFGHIJKLMNOPQRSTUVWXYZ"; for (int i = 0; i < length; i++) { if (std::wstring::npos != disk.find(data[i])) { result->push_back(data[i]); } } return result; } (GetLogicalDriveStrings(sizeof(data), data)); }
热门排行