存在任何与 swscanf 等效的 Delphi RTL 函数

发布于 2024-12-29 19:32:20 字数 188 浏览 4 评论 0原文

我正在寻找相当于 的 RTL delphi 函数sscanf/swscanf C++ 函数。 RTL delphi 函数中是否存在类似的东西,或者我必须寻找第三方实现?

I'm looking for RTL delphi function equivalent to the sscanf/swscanf C++ functions. Exist something like that in the RTL delphi functions or I must look for a third-party implementation?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

无需解释 2025-01-05 19:32:20

我个人会简单地调用可以从 msvcrt.dll 导入的实际函数。

function sscanf(buffer, format: PAnsiChar): Integer; 
    cdecl; varargs; external 'msvcrt.dll';
function swscanf(buffer, format: PWideChar): Integer; 
    cdecl; varargs; external 'msvcrt.dll';

这些是 C 标准库函数经过尝试和测试的可靠实现。

I personally would simply call the real functions which can be imported from msvcrt.dll.

function sscanf(buffer, format: PAnsiChar): Integer; 
    cdecl; varargs; external 'msvcrt.dll';
function swscanf(buffer, format: PWideChar): Integer; 
    cdecl; varargs; external 'msvcrt.dll';

These are tried and tested robust implementations of the C standard library functions.

夜无邪 2025-01-05 19:32:20

您可以下载Delphi的扫描功能,这是移植的MSVC RTL功能。

You can download Scan function for Delphi, which is ported MSVC RTL function.

空城缀染半城烟沙 2025-01-05 19:32:20

http://cc.embarcadero.com/item/24258 有一个 sscanf 端口,但它看起来早于 Unicode,因此可能需要对 XE 进行一些调整。

There's a port of sscanf at http://cc.embarcadero.com/item/24258 but it looks to pre-date Unicode so may need some tweaks for XE.

╄→承喏 2025-01-05 19:32:20

即使在 C 中,这些也是已弃用的函数。使用更现代和类型安全的东西来解析数据。这将成为您的应用程序中错误的丰富来源。例如,您打算如何使 (wchar_t *) C 风格的 scanf 字符串函数与 Delphi 字符串进行互操作?

These are deprecated functions even in C. Use something more modern and type-safe to parse your data. This is going to be a rich source of errors in your application. For example, how do you intend to make a (wchar_t *) C style scanf string function interoperate with Delphi Strings?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文