简体   繁体   中英

BCB swprintf not working

Anyone else encountered a problem like this?

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

Message box prints out "%ws" not the contents of var.

Thanks.

C++Builder does not support all of the size prefixes that Visual Studio supports (and vice versa). In this case, C++Builder does not support the w prefix for %s , but Visual Studio does.

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 

If var is a wide string, you can use %s or %ls in both compilers.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM