开发者

wchar_t pointer manipulation - How to check whether it is ended with L".xls"

I am using C. I have a wchar_t pointer whi开发者_JAVA技巧ch pointing a a file path.

I was wondering, how I can check, whether it is ended with L".xls"?

Any function call I can use?


  • Check that the string is at least 4 long
  • See if the last 4 wchar_t are ".xls"

Thus, this should be it:

if(wcslen(str) >= 4 && wcscmp(str + wcslen(str) - 4, L".xls") == 0)


Try wcsstr().

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜