0
#include <iostream>
#include <stdio.h>
#include <wchar.h>
using namespace std;

int main()
{
 wchar_t* val = L"do";
 wchar_t* param = L"it";
 wcscat(val, param);
 std::wcout << val;
}

I'm getting a segmentation fault. I need to concatenate these 2:

wchar_t* val = L"Do";
wchar_t* param= L"it";
Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
  • 1
    stop using wscat, current C++ should not have to use pointers for this. The bad thing with the legacy "C" api's is that you end up using "raw pointers" with unclear ownership. Just use std::wstring, and/or std::wstringstream for building up your strings. – Pepijn Kramer Mar 16 '23 at 10:36

0 Answers0