Tony Lambregts a écrit:
when I change the code to the following LONG WINAPI RegSaveKeyA( HKEY hkey, LPCSTR file, LPSECURITY_ATTRIBUTES sa ) { WCHAR fileW[MAX_PATH]; LONG ret, len; len = WideCharToMultiByte(CP_ACP, 0, fileW, -1, file, 0, NULL, NULL); WideCharToMultiByte(CP_ACP, 0, fileW, -1, file, len, NULL, NULL); ret = RegSaveKeyW( hkey, fileW.Buffer, sa ); return ret; }
I get the following warning
warning: passing arg 5 of `WideCharToMultiByte' discards qualifiers from pointer target type
WideCharToMultiByte does not like LPCSTR. So what to do?
Of course it doesn't, it's the destination :) MultiByteToWideChar will do the file ==> fileW conversion.
Vincent