ckv
ckv

Reputation: 10830

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?

Upvotes: 9

Views: 20604

Answers (2)

asveikau
asveikau

Reputation: 40254

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

Upvotes: 11

Naveen
Naveen

Reputation: 73473

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

Upvotes: 7

Related Questions