fork download
  1. #include <iostream>
  2. #include <filesystem>
  3. #include <cstdint>
  4.  
  5. #include <Windows.h>
  6. #include <Windowsx.h>
  7. #include <ShlObj.h>
  8.  
  9. //http://y...content-available-to-author-only...u.net/computer/program/sdk/base/SHGetSpecialFolderPath/csidl.html
  10.  
  11. std::filesystem::path GetWindowsSpecalPass(int CSIDL) {
  12. constexpr std::uintmax_t L = (0x7fffff)*sizeof(TCHAR);//fuse buffer...
  13. TCHAR CH[L] = {0,};
  14.  
  15. if (SHGetSpecialFolderPath(nullptr, CH, CSIDL,0) == 0) { return {}; }
  16.  
  17. return { CH };
  18. }
  19.  
  20.  
  21. int main() {
  22. std::filesystem::path p = GetWindowsSpecalPass(CSIDL_PERSONAL);
  23. /**/
  24. for (const std::filesystem::path& o : std::filesystem::directory_iterator(p)) {
  25. std::cout << o << std::endl;
  26. }
  27. /**/
  28. return 0;
  29. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:5:10: fatal error: Windows.h: No such file or directory
 #include <Windows.h>
          ^~~~~~~~~~~
compilation terminated.
stdout
Standard output is empty