Home > System Tutorial > LINUX > body text

What is the default format for single-byte/double-byte characters?

王林
Release: 2024-02-24 13:00:31
forward
540 people have browsed it

sprintf、swprintf

are for single-byte/double-byte characters respectively. wsprintf can under-form single-byte/double-byte characters according to different predefined indicators. Comparing wsprintf and swprintflinux sprintf header file, although these two functions are the same for users, the latter is declared in Winbase.h; the former is declared in stdio.h, stdlib.h stated in the document. For wsprintf, the compiler will detect the macros you define during the compilation process, and then convert the functions starting with _tcs in the TCHAR.H file into the corresponding functions starting with str or wcs. If you want to build a program that uses the UNICODE character set, you can define the _UNICODE macro. If you want to build a single-byte program, you do not need to define any macroslinux sprintf header file. Single-byte character programs are the default (this is the case for WIN32, and the default for WINCE is unicode character programs).

is used the same as sprintf, #include

intmain(){

linux sprintf 头文件_c++万能头文件_降薪办已成立红头文件

wchar_ta[123];

swprintf(a,L"%f",123.456);wprintf(a);}

linux sprintf 头文件_降薪办已成立红头文件_c++万能头文件

Note that L must be added to the second parameter to specify it as a wide character string

wsprintf is windowsapi, which does not support floating-point output to LINUX virtual machines. swprintf is a c library function. Its usage is the same as sprintf (the format is the same), but it is for wide characters.

The above is the detailed content of What is the default format for single-byte/double-byte characters?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:itcool.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!