I am currently developing a program with WinHTTP and I'm getting stuck while modifying the value of an LPWSTR
in the URL_COMPONENT
struct.
I make a simple script that describes my problem:
#include <windows.h>
#include <stdio.h>
int main(int argc, char const *argv[])
{
LPWSTR country = L"America, England, Belgium";
size_t pos = 0;
while(country[pos] != 44) pos++;
country[pos] = 0;
printf("%ls\n", country); // 0x4015b0
return 0;
}
The program receives a SIGSEGV signal on the line country[pos] = 0