gpt4 book ai didi

c++ - BCB swprintf 不工作

转载 作者:行者123 更新时间:2023-11-30 17:18:38 24 4
gpt4 key购买 nike

还有人遇到过这样的问题吗?

swprintf_s(v, len, L"%ws", var);
MessageBox(NULL, v, NULL' NULL);

消息框打印出“%ws”而不是var的内容。

谢谢。

最佳答案

C++Builder 不支持 Visual Studio 支持的所有大小前缀(反之亦然)。在这种情况下,C++Builder 不支持 %sw 前缀,但 Visual Studio 支持。

Visual Studio :

Format Specification Syntax: printf and wprintf Functions

A format specification, which consists of optional and required fields, has the following form:

%[flags] [width] [.precision] [{h | l | ll | w | I | I32 | I64}] type

C++Builder:

printf Format Specifiers

Print format specifiers have the following form:

% [flags] [width] [.prec] [F|N|h|l|L] type_char

如果 var 是宽字符串,则可以在两个编译器中使用 %s%ls

关于c++ - BCB swprintf 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29130917/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com