SQLCHAR * driverDesc[256]; SQLCHAR dsnName[256];
SQLDataSources(henv, direction,
(SQLWCHAR*)dsnName,
sizeof(dsnName),
&dsnNameLenReturned,
(SQLWCHAR*)driverDesc,
sizeof(driverDesc),
&driverDescLenReturned);
So you now have two character arrays filled with Unicode characters. So when you try to print them as ASCII you get the results you see. You need to understand that using a cast does not change the original item, it just tells the compiler to ignore the item's declared type, and assume that you the programmer know what you are doing.
So change the definitions to
SQLWCHAR driverDesc[256]; SQLWCHAR dsnName[256];
And do not use
sizeof
to get the number of wide characters. That returns the number of bytes, so you need to divide by 2, or use
_countof
instead.