Hello,
I have written a program that gets information from Active Directory. This
is the function I'm using:
void ADSysGetUserName(IADsADSystemInfo * pSys, char * data) {
HRESULT hr;
BSTR bstr;
hr = pSys->get_UserName(&bstr);
if (SUCCEEDED(hr)) {
sprintf((char*)data, "%S", bstr);
}
SysFreeString(bstr);
}
I call it using:
char temp[500];
ADSysGetComputerName(pSys, temp);
The problem I'm getting is that when a user's name contains special
characters (such as éèöü ...) and I'm getting it, it modifies those
characters. In the table below, you can see that Düvoçréè (just a test name)
is returned as D³voşrÜŞ. The values in the left column are the correct ASCII
values.
68 D D
252 ³ ü
118 v v
111 o o
231 ş ç
114 r r
233 Ú é
232 Ş è
I was always under the impression that a char could also handle these
special characters. Does anyone know what is wrong here? Should I use
another type. Could anyone provide me with an example?
Thanks in advance,
WiWa