convert std::string to const BYTE* for RegSetValueEx()

后端 未结 4 988
深忆病人
深忆病人 2021-01-19 07:54

I have a function that gets a std::string. That function calls

RegSetValueEx

the 5th parameter is the value of the registry value and expects a variable of t

4条回答
  •  情话喂你
    2021-01-19 08:30

    The * 2 is because RegSetValueEx wants to know the number of bytes to write und each char (wchar_t) in a wstring is two bytes wide. So the resulting byte-array has twice the size!

提交回复
热议问题