【发布时间】:2019-09-10 04:13:06
【问题描述】:
在 Windows 驱动程序 C 代码中,我需要将 WCHAR 数组设置为在头文件中 #defined 的字符串。头文件指定一个 ascii 字符串。它没有为字符串指定 L 前缀。
// In the header file
#define VERS_STR "3.2.4"
// In the C file, none of the following work
WCHAR awcStr[] = LVERS_STR; // Compiler Error: Treated as one name
WCHAR awcStr[] = L VERS_STR; // Compiler Error: L is unknown
WCHAR awcStr[] = L(VERS_STR); // Compiler Error
WCHAR awcStr[] = L"3.2.4"; // Compiles and runs, but I must use #define instead
我会在#define 上调用一个转换例程,但我找不到可以使用 C 代码从 Windows 驱动程序调用的转换例程。
【问题讨论】:
标签: unicode driver string-literals wchar