SML 在位级别比较文件

发布于 2024-07-07 06:58:11 字数 456 浏览 2 评论 0原文

我正在尝试使用 SML 比较目录中的文件。 使用 TextIO 库相当简单,但我需要在位级别比较文件。 即二进制比较。 我正在使用与此类似的函数:

fun listDir (s) = let
    fun loop (ds) = (case OS.FileSys.readDir (ds)
        of "" => [] before OS.FileSys.closeDir (ds)
      | file => file::loop (ds))
      val ds = OS.FileSys.openDir (s)
      in
         loop (ds) handle e => (OS.FileSys.closeDir (ds); raise (e))
      end

列出给定目录中的所有文件。 但现在,我需要查看每个文件中的位。 有什么建议么?

I am attempting to compare files in a directory using SML. Using the TextIO library is fairly easy but I need to compare the files at the bit level. That is, a binary compare. I am using a function similar to this:

fun listDir (s) = let
    fun loop (ds) = (case OS.FileSys.readDir (ds)
        of "" => [] before OS.FileSys.closeDir (ds)
      | file => file::loop (ds))
      val ds = OS.FileSys.openDir (s)
      in
         loop (ds) handle e => (OS.FileSys.closeDir (ds); raise (e))
      end

to list all the files in a given directory. But now, I need to look at the bits in each file. Any suggestions?

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

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

发布评论

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

评论(1

浪漫人生路 2024-07-14 06:58:11

看一下 BinIO 结构。

Take a look at the BinIO structure.

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