Win32 API 中的`A` 和`W` 函数有什么区别? [英] What is the difference between the `A` and `W` functions in the Win32 API?

查看:30
本文介绍了Win32 API 中的`A` 和`W` 函数有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

调用末尾附加 A 字符而不是 W 字符的 Win32 API 函数有什么区别.

我知道这意味着 ASCIIWIDE CHARACTER 或 Unicode,但是输出或输入有什么区别?

例如,如果我调用 GetDefaultCommConfigA,它会用 ASCII 字符串而不是 WCHAR 字符串填充我的 COMMCONFIG 结构吗?(对于 GetDefaultCommConfigW 反之亦然)

换句话说,我怎么知道字符串是用什么编码的,ASCII 或 UNICODE,它必须由我调用的函数的版本决定 A 或 <代码>W?正确吗?

我发现了这个问题,但我不这么认为回答我的问题.

解决方案

A 函数使用 Ansi(而非 ASCII)字符串作为输入和输出,而 W 函数使用改用 Unicode 字符串(NT4 及更早版本上的 UCS-2,W2K 及更高版本上的 UTF-16).有关详细信息,请参阅 MSDN.>

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.

解决方案

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.

这篇关于Win32 API 中的`A` 和`W` 函数有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆