乐趣区

关于zip:libzip开发笔记一libzip库介绍编译和工程模板

若该文为原创文章,转载请注明原文出处
本文章博客地址:https://blog.csdn.net/qq21497936/article/details/111876926
长期继续带来更多我的项目与技术分享,征询请加 QQ:21497936、微信:yangsir198808
红瘦子 (红模拟) 的博文大全:开发技术汇合(蕴含 Qt 实用技术、树莓派、三维、OpenCV、OpenGL、ffmpeg、OSG、单片机、软硬联合等等)继续更新中…(点击传送门)

Qt 开发专栏:三方库开发技术

前言

  Qt 应用一些压缩解压性能,抉择 libzip 库,libzip 库比拟原始,也是很多其余库的根底撑持库。

libzip

  libzip 是一个 C 库,用于读取,创立和批改 zip 档案。能够从数据缓冲区,文件或间接从其余 zip 归档文件间接复制的压缩数据中增加文件。在不敞开存档的状况下所做的更改能够还原。
  以后版本是 1.7.3,于 2020 年 7 月 15 日公布。
  官网:https://libzip.org/
  QQ 群:1047134658(点击“文件”搜寻“libzip”,群内与博文同步更新)

libzip 编译

步骤一:解压

步骤二:Cmake 配置(vs2017 x64 版本)

  须要 zlib,之前曾经编译过 vs2017 x64 版本的 zlib 了,导入再配置

步骤三:生成工程

步骤四:关上 VS2017 编译

步骤五:装置 install

模块化

补充:查看命令行工具帮忙和源码辅助开发

ziptool.exe -h
usage: ziptool.exe [-ceghnrst] [-l len] [-o offset] archive command1 [args] [command2 [args] ...]

Supported options are:
        -c              check consistency
        -e              error if archive already exists (only useful with -n)
        -g              guess file name encoding (for stat)
        -h              display this usage
        -l len          only use len bytes of file
        -n              create archive if it doesn't exist
        -o offset       start reading file at offset
        -r              print raw file name encoding without translation (for stat)
        -s              follow file name convention strictly (for stat)
        -t              disregard current archive contents, if any

Supported commands and arguments are:
        add name content
            add file called name using content

        add_dir name
            add directory

        add_file name file_to_add offset len
            add file to archive, len bytes starting from offset

        add_from_zip name archivename index offset len
            add file from another archive, len bytes starting from offset

        cat index
            output file contents to stdout

        count_extra index flags
            show number of extra fields for archive entry

        count_extra_by_id index extra_id flags
            show number of extra fields of type extra_id for archive entry

        delete index
            remove entry

        delete_extra index extra_idx flags
            remove extra field

        delete_extra_by_id index extra_id extra_index flags
            remove extra field of type extra_id

        get_archive_comment
            show archive comment

        get_extra index extra_index flags
            show extra field

        get_extra_by_id index extra_id extra_index flags
            show extra field of type extra_id

        get_file_comment index
            get file comment

        get_num_entries flags
            get number of entries in archive

        name_locate name flags
            find entry in archive

        print_progress
            print progress during zip_close()

        rename index name
            rename entry

        replace_file_contents index data
            replace entry with data

        set_archive_comment comment
            set archive comment

        set_extra index extra_id extra_index flags value
            set extra field

        set_file_comment index comment
            set file comment

        set_file_compression index method compression_flags
            set file compression method

        set_file_dostime index time date
            set file modification time and date (DOS format)

        set_file_encryption index method password
            set file encryption method

        set_file_mtime index timestamp
            set file modification time

        set_file_mtime_all timestamp
            set file modification time for all files

        set_password password
            set default password for encryption

        stat index
            print information about entry


Supported flags are:
        0       (no flags)
        C       ZIP_FL_NOCASE
        c       ZIP_FL_CENTRAL
        d       ZIP_FL_NODIR
        l       ZIP_FL_LOCAL
        u       ZIP_FL_UNCHANGED

Supported compression methods are:
        default
        deflate
        store

Supported encryption methods are:
        none
        AES-128
        AES-192
        AES-256
        PKWARE

The index is zero-based.

工程模板 v1.0.0

  对应工程模板:zipDemo_v1.0.0_根底模板_zip 库的根底环境.rar

若该文为原创文章,转载请注明原文出处
本文章博客地址:https://blog.csdn.net/qq21497936/article/details/111876926

退出移动版