Difference between char* and wchar_t*

前端 未结 4 1803
青春惊慌失措
青春惊慌失措 2020-12-30 09:59

I am new to MFC. I am trying to do simple mfc application and I\'m getting confuse in some places. For example, SetWindowText have two api, SetWindowTextA

4条回答
  •  失恋的感觉
    2020-12-30 10:27

    SetWindowTextA takes char* which is a pointer to an ANSI strings and SetWindowTextW take wchar_t* can point to wide strings aka Unicode.

    SetWindowText has been #defined to either of these in header Windows.h based on the type of application you are building. If you are building UNICODE build then your code will automatically use SetWindowTextW.

    SetWindowTextA is there primarily to support legacy code which needs to be build as SBCS (Single byte character set)

提交回复
热议问题