fork download
  1. #include <iostream>
  2. #include <Windows.h>
  3.  
  4. int main(int argc, char* argv[])
  5. {
  6. std::wstring s = L"SomeString";
  7. const TCHAR* winString = s.c_str();
  8. size_t length = s.length();
  9. int agRequiredLength = WideCharToMultiByte(CP_UTF8, 0, winString, length + 1, NULL, 0, NULL, NULL);
  10.  
  11. std::cout << agRequiredLength << std::endl;
  12.  
  13. std::cin.get();
  14. return 0;
  15. }
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty