代码之家  ›  专栏  ›  技术社区  ›  berkay

如何在我的代码中附加不同的文件并提取它们以供验证?

c c++
  •  1
  • berkay  · 技术社区  · 15 年前

    文件在一起,但稍后我将使用相同的“只有一个文件”来提取文件并在我的代码中进行验证。

    谢谢。

    2 回复  |  直到 15 年前
        1
  •  1
  •   salezica    15 年前

    嗯,。。。我想你想做的是把两个文件存储在一个文件中,然后从那个文件中提取两个文件,但是如果我误解了,请纠正我。

    你可以只使用zip(gzip,7zip,随便什么)而不压缩。如果要自己编写代码,可以将以下信息存储在文件中:

    offset 0 - 3: a 4-byte integer with the length of the first file.
    offset 4 - 7: a 4-byte integer with the length of the second file.
    offset 8+: the first file, followed by the second file.
    

    如果你需要帮助,请便!

        2
  •  2
  •   Å imon Tóth    15 年前