I have tried wcscat() but i get a runtime access violation.
wchar_t* a = L"aaa";
wchar_t* b = L"bbb";
wchar_t* c;
c = wcscat(a, b);
Can somebody tell me what is wrong here? Or another way to solve my problem? Thanks
wcscat
doesn't create a new string - it simply appends b
to a
. So, if you want to make sure you don't cause a runtime access violation, you need to make sure there's space for b
at the end of a
. In the case above:
wchar_t a[7] = L"aaa";
wchar_t b[] = L"bbb";
wchar_t* c;
c = wcscat(a, b);
You can still get a return value from the function, but it will simply return a
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With