我已将指针size_Drive定义为:
PCHAR size_Drive ;
然后我使用了函数lstrlen:
size_Drive += (lstrlen(size_Drive) + 1) ; (line 28)
但它给了我以下错误:
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
答案 0 :(得分:1)
PCHAR
是char
的typedef,而LPCWSTR
是const wchar_t*
的typedef,而Unicode版本lstrlen
是Unicode函数的宏lstrlenW
。
您应该专门致电lstrlenA
以使用ANSI功能。