Is it advisable to use strcmp or _tcscmp for comparing strings in Unicode versions?

耗尽温柔 提交于 2019-12-10 12:44:13

问题


Is it advisable to use strcmp or _tcscmp for comparing strings in Unicode versions?


回答1:


_tcscmp() is a macro. If you define UNICODE it will use wcscmp(), otherwise it will use strcmp().

Note the types TCHAR, PTSTR, etc. are similar. They will be WCHAR and PWSTR if you define UNICODE, and CHAR and PSTR otherwise.




回答2:


No, you should use _tcscmp . That will resolve to proper function depending upon on your compiler flags.



来源:https://stackoverflow.com/questions/2107103/is-it-advisable-to-use-strcmp-or-tcscmp-for-comparing-strings-in-unicode-versio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!