存在任何与 swscanf 等效的 Delphi RTL 函数
我正在寻找相当于 的 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我个人会简单地调用可以从 msvcrt.dll 导入的实际函数。
这些是 C 标准库函数经过尝试和测试的可靠实现。
I personally would simply call the real functions which can be imported from msvcrt.dll.
These are tried and tested robust implementations of the C standard library functions.
您可以下载Delphi的扫描功能,这是移植的MSVC RTL功能。
You can download Scan function for Delphi, which is ported MSVC RTL function.
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.
即使在 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?