What is the difference between the `A` and `W` functions in the Win32 API?

Questionaire picture Questionaire · Sep 15, 2011 · Viewed 11.9k times · Source

What is the difference in calling the Win32 API function that have an A character appended to the end as opposed to the W character.

I know it means ASCII and WIDE CHARACTER or Unicode, but what is the difference in the output or the input?

For example, If I call GetDefaultCommConfigA, will it fill my COMMCONFIG structure with ASCII strings instead of WCHAR strings? (Or vice-versa for GetDefaultCommConfigW)

In other words, how do I know what Encoding the string is in, ASCII or UNICODE, it must be by the version of the function I call A or W? Correct?

I have found this question, but I don't think it answers my question.

Answer

Remy Lebeau picture Remy Lebeau · Sep 15, 2011

The A functions use Ansi (not ASCII) strings as input and output, and the W functions use Unicode string instead (UCS-2 on NT4 and earlier, UTF-16 on W2K and later). Refer to MSDN for more details.