You set your buffer (buff
) as a unicode (2 bytes for each character) string (You call the GetDlgItemTextW
function which works with unicode strings and, pass a LPTSTR
to it which is a wchar_t*
if _UNICODE
is defined.).
If you try to read buff
as a char*
(1 byte for each character), that can be the reason you see an additional 0 after each byte.