Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 581
ckv Avatar asked Jan 21 '10 05:01

ckv


2 Answers

_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.

like image 108
asveikau Avatar answered Sep 18 '22 03:09

asveikau


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

like image 36
Naveen Avatar answered Sep 19 '22 03:09

Naveen