开发者

How can you remove the last character from a wchar_t*?

How can I delete the last character of a wchar_t* and resize accordingly? For example, having the string "test" and bringing it开发者_JS百科 down to "tes"


How about str[wcslen(str) - 1] = '\0'

Make sure the string is at least 1 character long first though!


Would you please explain what you mean by "resize accordingly"? Do you want to resize the buffer that was allocated? (Even if you think you do, you probably don't, because resizing to shave one character will probably throw the memory allocator off, but I think I should ask anyway)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜