I have something like this:
if(GetFileAttributesW("C:\\Directory")!="INVALID_FILE_ATTRIBUTES") {...}
I get error: cannot convert 'const char*' to 'const WCHAR*' for argument '1' to 'DWORD GetFileAttributesW(const WCHAR*)'
How to convert const char*
to const WCHAR*
?
Don't use GetFileAttributesW
, use GetFileAttributes
. Add _T
to all const strings, and use _TCHAR*
. And INVALID_FILE_ATTRIBUES
is definitely not a string...
if(GetFileAttributes(_T("C:\\Directory"))!= INVALID_FILE_ATTRIBUTES )
{...}