sách gpt4 ăn đã đi

c - 确定文件是否是 zip 存档内的目录

In lại 作者:太空狗 更新时间:2023-10-29 15:40:10 24 4
mua khóa gpt4 giày nike

我根据规范读取 zip 文件,并从中央目录获取每个文件的信息。从我读到的标题中:

#define VERSION_NEEDED_OFSSET 6

UINT16 versionNeeded = (UINT16)*(zipFile + VERSION_NEEDED_OFSSET);

所以我压缩了一些文件,还有一些目录,当我得到关于目录的信息时,我得到了 versionNeeded = 0x000a

根据我阅读的文档:

The minimum supported ZIP specification version needed to extract the file, mapped as above. This value is based on the specific format features a ZIP program MUST support to be able to extract the file. If multiple features are applied to a file, the minimum version MUST be set to the feature having the highest value. New features or feature changes affecting the published format specification will be implemented using higher version numbers than the last published value to avoid conflict.

4.4.3.2 Current minimum feature versions are as defined below:

1.0 - Default value

1.1 - File is a volume label

2.0 - File is a folder (directory)

但是 zip header 中用于确定文件类型的部分是什么?我看不到任何与 tài liệu 中的文件类型有关的类型或位.

câu trả lời hay nhất

好的。如果有人发现这个,正确的方法是检查中央目录开始处的偏移量加上 38,一个名为 external file attributes

的字段

来自文档:

4.4.15 external file attributes: (4 bytes) The mapping of the external attributes is host-system dependent (see 'version made by'). For MS-DOS, the low order byte is the MS-DOS directory attribute byte. If input came from standard input, this field is set to zero.

UINT32 external_attributes = (UINT32)*(zipFile + 38);

然后将此值与 cái này 进行匹配来自 MSDN 的常量。

要匹配目录,请像这样比较external_attributes:

if(external_attributes == 0x10) //FILE_ATTRIBUTE_DIRECTORY

关于c - 确定文件是否是 zip 存档内的目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39290157/

24 4 0
Chứng chỉ ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com
Xem sitemap của VNExpress