C++ Builder 参考手册 ➙ System::Sysutils ➙ FormatBuf
格式化数据到字符串
头文件:#include <System.SysUtils.hpp>
命名空间:System::Sysutils
函数原型:
unsigned __fastcall FormatBuf(void *Buffer, unsigned BufLen,
const void *Format, unsigned FmtLen,
const System::TVarRec *Args, const int Args_High);
unsigned __fastcall FormatBuf(ystem::WideChar * Buffer, unsigned BufLen,
const void *Format, unsigned FmtLen,
const System::TVarRec *Args, onst int Args_High);
unsigned __fastcall FormatBuf(ystem::WideChar * Buffer, unsigned BufLen,
const void *Format, unsigned FmtLen,
const System::TVarRec *Args, const int Args_High,
const TFormatSettings &AFormatSettings);
unsigned __fastcall FormatBuf(System::UnicodeString &Buffer, unsigned BufLen,
const void *Format, unsigned FmtLen,
const System::TVarRec *Args, const int Args_High);
unsigned __fastcall FormatBuf(System::UnicodeString &Buffer, unsigned BufLen,
const void *Format, unsigned FmtLen,
const System::TVarRec *Args, const int Args_High,
const TFormatSettings &AFormatSettings);
unsigned __fastcall FormatBuf(void *Buffer, unsigned BufLen,
const void *Format, unsigned FmtLen,
const System::TVarRec *Args, const int Args_High,
const TFormatSettings &AFormatSettings);
参数:
- Buffer:用于返回生成的字符串;
- BufLen:参数 Buffer 的长度 (可以容纳的字符个数);
- Format:输出数据的格式;
- FmtLen:参数 Format 的长度 (包含字符的个数);
- Args:要输出的数据数组;
- Args_High:数据的个数减1;
- AFormatSettings:地区格式;
返回值:
- 按照 Format 参数的格式输出参数 Args 数据到字符串,通过参数 Buffer 返回生成的字符串;
- 这个函数的参数及生成的字符串规则和 Format 函数相同。
- 没有 AFormatSettings 参数的函数不是线程安全的,因为使用了全局变量作为地区格式;带有 AFormatSettings 参数的函数是线程安全的。
相关:
- System::Sysutils::Format
- System::Sysutils::FormatBuf
- System::Sysutils::FormatCurr
- System::Sysutils::FormatDateTime
- System::Sysutils::FormatFloat
- System::Sysutils::FmtStr
- System::Sysutils::FmtLoadStr
- System::Sysutils::StrFmt
- System::Sysutils::StrLFmt
- System::Sysutils::WideFormat
- System::Sysutils::WideFormatBuf
- System::Sysutils::WideFmtStr
- System::Sysutils
- std::printf, std::_tprintf, std::wprintf
- std::sprintf, std::_stprintf, std::swprintf
- std::vprintf, std::_vtprintf, std::vwprintf
- std::vsprintf, std::_vstprintf, std::vswprintf
- std::snprintf, std::_sntprintf, std::snwprintf
- std::vsnprintf, std::_vsntprintf, std::vsnwprintf
- <cstdio>
C++ Builder 参考手册 ➙ System::Sysutils ➙ FormatBuf