0
  • I have defined the pointer size_Drive as :

    PCHAR size_Drive ;
    

    then i used the function lstrlen :

    size_Drive += (lstrlen(size_Drive) + 1) ;  (line 28)
    

    but it gives me the following ERROR :

    1>c:\users\hp.hp-pc\documents\visual studio 2008\projects\getvolumeinfo\getvolumeinfo\getvolumeinfo.cpp(28) : error C2664: 'lstrlenW' : cannot convert parameter 1 from 'PCHAR' to 'LPCWSTR'
    1>        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
    
4

1 回答 1

1

PCHAR是 typedef ,charLPCWSTR是 typedef const wchar_t*,并且在 Unicode 构建lstrlen中是 Unicode 函数的宏lstrlenW

您应该lstrlenA专门调用以使用 ANSI 函数。

于 2013-06-25T00:35:41.480 回答