WinApi file mapping puts strange whitespaces between each symbol

46 views Asked by At

I'm a newbie in WinApi programming. I'm creating a file mapping program. A user enters some string to the input and this text has to be put into a file. But in the file I get strange white spaces between each symbol. For instance, if I enter "Some text", I get "S o m e t e x t". Why is it?

pBuf = (LPTSTR)MapViewOfFile(fileMap, FILE_MAP_ALL_ACCESS, 0, 0, 10240000);
...
GetWindowText(teacherInput, teacher, 31);
memcpy((PVOID)pBuf, teacher, 31 * charSize);
1

There are 1 answers

0
serg66 On

As Raymond Chen stated in the comments, this happend because the encodings don't match.