fork download
  1. #include <iostream>
  2. #include <sstream>
  3. #include <string>
  4. using namespace std;
  5.  
  6. int main() {
  7.  
  8. std::wstringstream wstringCmd;
  9.  
  10. std::wstring wstrExec = L"\"C:\\Windows\\system32\\mspaint.exe\" ";
  11. std::string strPic = "image.png";
  12.  
  13. // wstringCmd << wstrExec.c_str() << strPic; // <-- does not compile!
  14. wstringCmd << wstrExec.c_str() << strPic.c_str();
  15.  
  16. //std::string wstrCommande = wstringCmd.str(); // <-- does not compile!
  17. std::wstring wstrCommande = wstringCmd.str();
  18.  
  19. std::wcout << wstrCommande;
  20. return 0;
  21. }
Success #stdin #stdout 0s 4512KB
stdin
Standard input is empty
stdout
"C:\Windows\system32\mspaint.exe" image.png