在查看了一些 Flutter 文档后,我仍然对 Box 和 Sliver 协议(即 BoxConstraints 和 SliverConstraints)之间的差异感到困惑。
两者有何区别?
我想测试压缩和解压缩功能:compress()uncompresss()由ZLIB库提供; 编写了下面的代码来打开一个已经存在的文件,在while()循环中读取内部文件的内容已经存在,压缩部分写入单个文件,解压缩部分写入另一个文件,代码如下所示,已存在的文件大小(originalFile)约为78K,第一次进入while()循环压缩时返回值的解压缩为0,这样第一个条目成功,但第二个和下一个条目成功要输入,返回值是-5(根据官方文档,缓冲输出大小不包含内容),为什么?哪里错了?非常感谢你!
enter code here
#include <string>
#include <time.h>
#include <stdio.h>
#include <iostream>
#include <string.h>
#include "zlib.h"
int main()
{
unsigned long int fileLength;
unsigned long int readLength;
unsigned long int compressBufLength;
unsigned long int uncompressLength;
unsigned long int offset;
unsigned char *readBuf = new unsigned char[512];//the readbuf of the exist file content
unsigned char *compressBuf = new unsigned char[512];//the compress buffer
unsigned char *uncompressBuf = new unsigned char[512];//the uncompress content buffer
FILE *originalFile = fopen("/lgw150/temp/src/lg4/original.lg4","a+");//the exist file
FILE *compressedFile …Run Code Online (Sandbox Code Playgroud)