Why does it appear that wstring is empty, but there is something there [closed]

image

image

There is a std::wstring title that seems to be empty, but it seems not… I need to use the value, but it is empty, although I wrote something there. But I can’t use it.

I don’t know how it works, I read it on the Internet, but I don’t quite understand it, and I don’t have much time.

  • 3

    The first character is a null character. A lot of features that handle strings of characters, including most output functions, will only read a function up to the first null character, because that is how it was done in C and early C++. Your string contains 20 characters, but a lot of functions will think it’s empty because it starts with a null character.

    – 

  • 1

    “I don’t have much time” – That’s completely irrelevant here.

    – 

Leave a Comment