<tfoot id='g2oCi'></tfoot>
  1. <i id='g2oCi'><tr id='g2oCi'><dt id='g2oCi'><q id='g2oCi'><span id='g2oCi'><b id='g2oCi'><form id='g2oCi'><ins id='g2oCi'></ins><ul id='g2oCi'></ul><sub id='g2oCi'></sub></form><legend id='g2oCi'></legend><bdo id='g2oCi'><pre id='g2oCi'><center id='g2oCi'></center></pre></bdo></b><th id='g2oCi'></th></span></q></dt></tr></i><div id='g2oCi'><tfoot id='g2oCi'></tfoot><dl id='g2oCi'><fieldset id='g2oCi'></fieldset></dl></div>
    <legend id='g2oCi'><style id='g2oCi'><dir id='g2oCi'><q id='g2oCi'></q></dir></style></legend>

    <small id='g2oCi'></small><noframes id='g2oCi'>

      <bdo id='g2oCi'></bdo><ul id='g2oCi'></ul>

    1. 如何检查文件是否是 gzip 压缩的?

      How to check if a file is gzip compressed?(如何检查文件是否是 gzip 压缩的?)
        <tbody id='azocJ'></tbody>

          <legend id='azocJ'><style id='azocJ'><dir id='azocJ'><q id='azocJ'></q></dir></style></legend>
            <bdo id='azocJ'></bdo><ul id='azocJ'></ul>
            <i id='azocJ'><tr id='azocJ'><dt id='azocJ'><q id='azocJ'><span id='azocJ'><b id='azocJ'><form id='azocJ'><ins id='azocJ'></ins><ul id='azocJ'></ul><sub id='azocJ'></sub></form><legend id='azocJ'></legend><bdo id='azocJ'><pre id='azocJ'><center id='azocJ'></center></pre></bdo></b><th id='azocJ'></th></span></q></dt></tr></i><div id='azocJ'><tfoot id='azocJ'></tfoot><dl id='azocJ'><fieldset id='azocJ'></fieldset></dl></div>
            • <tfoot id='azocJ'></tfoot>
            • <small id='azocJ'></small><noframes id='azocJ'>

              • 本文介绍了如何检查文件是否是 gzip 压缩的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我有一个 C/C++ 程序,它需要读取一个文件,这个文件可能是也可能不是 gzip 压缩的.我知道我们可以使用 zlib 中的 gzread() 来读取压缩文件和未压缩文件 - 但是,我只想在文件是 gzip 压缩文件时使用 zlib 函数(出于性能原因).

                I have a C / C++ program which needs to read in a file that may or may not be gzip compressed. I know we can use gzread() from zlib to read in both compressed and uncompressed files - however, I want to use the zlib functions ONLY if the file is gzip compressed (for performance reasons).

                那么有没有办法以编程方式检测或检查某个文件是否是从 C/C++ 压缩的?

                So is there any way to programatically detect or check if a certain file is gzipped from C / C++?

                推荐答案

                文件开头有一个幻数.只需读取前两个字节并检查它们是否等于 0x1f8b.

                There is a magic number at the beginning of the file. Just read the first two bytes and check if they are equal to 0x1f8b.

                这篇关于如何检查文件是否是 gzip 压缩的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                What is inside .lib file of Static library, Statically linked dynamic library and dynamically linked dynamic library?(静态库、静态链接动态库和动态链接动态库的 .lib 文件里面是什么?)
                How do I load a C DLL from the SXS in Python?(如何从 Python 中的 SXS 加载 C DLL?)
                Can Cython code be compiled to a dll so C++ application can call it?(Cython 代码可以编译成 dll 以便 C++ 应用程序可以调用它吗?)
                Delay Loading DLLs(延迟加载 DLL)
                Throwing C++ exceptions across DLL boundaries(跨 DLL 边界抛出 C++ 异常)
                Loading a dll from a dll?(从 dll 加载 dll?)
                <legend id='9N51r'><style id='9N51r'><dir id='9N51r'><q id='9N51r'></q></dir></style></legend>
                    <tbody id='9N51r'></tbody>

                      <bdo id='9N51r'></bdo><ul id='9N51r'></ul>

                      1. <i id='9N51r'><tr id='9N51r'><dt id='9N51r'><q id='9N51r'><span id='9N51r'><b id='9N51r'><form id='9N51r'><ins id='9N51r'></ins><ul id='9N51r'></ul><sub id='9N51r'></sub></form><legend id='9N51r'></legend><bdo id='9N51r'><pre id='9N51r'><center id='9N51r'></center></pre></bdo></b><th id='9N51r'></th></span></q></dt></tr></i><div id='9N51r'><tfoot id='9N51r'></tfoot><dl id='9N51r'><fieldset id='9N51r'></fieldset></dl></div>

                        <small id='9N51r'></small><noframes id='9N51r'>

                        <tfoot id='9N51r'></tfoot>