当前位置: 首页 > news >正文

先用ps后用dw做网站别做网络推广员

先用ps后用dw做网站,别做网络推广员,网站开发 table,网站建设与网络设计课程前言 新建项目:pro文件中新增代码 LIBS -lz 在main.cpp函数中#include "zlib.h",如果此时运行代码提示没有找到对应的函数,那么就qt安装目录:D:\C\qt5.12.7\Tools\mingw730_64\x86_64-w64-mingw32\include(这里是博主…

前言

 新建项目:pro文件中新增代码

LIBS+= -lz

在main.cpp函数中#include "zlib.h",如果此时运行代码提示没有找到对应的函数,那么就qt安装目录:D:\C++\qt5.12.7\Tools\mingw730_64\x86_64-w64-mingw32\include(这里是博主的路径,作为参考找自己的路径)下查看是否有zlib.h头文件,复制这个文件到当前目录下即可运行

数据流压缩解压缩


#include "zlib.h"
#include <zlib.h>int main(int argc,char * argv[])
{
//    QApplication a(argc, argv);char text[] = "zlib compress and uncompress test\nturingo@163.com\n2012-11-05\n";uLong tlen = strlen(text) + 1;	/* 需要把字符串的结束符'\0'也一并处理 */char* buf = NULL;uLong blen;cout <<"start: tlen = "<< tlen << endl;/* 计算缓冲区大小,并为其分配内存 */blen = compressBound(tlen);	/* 压缩后的长度是不会超过blen的 */if((buf = (char*)malloc(sizeof(char) * blen)) == NULL){printf("no enough memory!\n");return -1;}cout << "compressBound: blen =  " << blen<< endl;
//        /* 压缩 */if(compress((Bytef*)buf, &blen,(Bytef*) text, tlen) != Z_OK){printf("compress failed!\n");return -1;}cout <<"compress \n";cout << strlen(buf)+1 << endl;cout <<"uncompress \n";/* 解压缩 */if(uncompress((Bytef*)text, &tlen, (Bytef*)buf, blen) != Z_OK){printf("uncompress failed!\n");return -1;}/* 打印结果,并释放内存 */printf("%s", text);if(buf != NULL){free(buf);buf = NULL;}//    return a.exec();return 0;
}
   char text[] = "zlib testddsa ";uLong tlen = strlen(text) + 1;	/* 需要把字符串的结束符'\0'也一并处理 */char* buf = NULL;uLong blen;cout <<"start: tlen = "<< tlen << endl;/* 计算缓冲区大小,并为其分配内存 */blen = compressBound(tlen);	/* 压缩后的长度是不会超过blen的 */if((buf = (char*)malloc(sizeof(char) * blen)) == NULL){printf("no enough memory!\n");return -1;}cout << "blen = " << blen<< endl;compress((Bytef*)buf,&blen,(Bytef*)text,tlen);cout << "blen = "<< blen<< endl;cout << "strlen(buf) = " << strlen(buf)<< endl;uLong ubound = compressBound(strlen(buf)+1 );/* 压缩后的长度是不会超过blen的 */cout << "bound =" << ubound<< endl;uncompress((Bytef*)text,&ubound,(Bytef*)buf,blen);cout << "unbound =" << ubound<< endl;

文件压缩解压缩

        uLong blen,tlen;char text[1024];char* dest;FILE* f,ff;
//        f = fopen("test.txt","r+");//        fread(text,1,1024,f);
//        tlen = strlen(text)+1;
//        cout << text << endl;
//        cout << "tlen = "<< tlen  << endl;//        blen = compressBound(tlen);
//        cout << "blen = "<< blen  << endl;//        dest = (char *)malloc(blen );
//        compress((Bytef*)dest,&blen,(Bytef*)text,tlen);//        cout << "blen = "<< blen  << endl;
//        ff = fopen("test.aaa","w");
//        fwrite(dest,blen,1,ff);
//        fclose(ff);
//        fclose(f);f= fopen("test.aaa","r+");fread(dest,1024,1,f);fclose(f);
//            cout << dest << endl;blen = compressBound(strlen(dest)+1);uncompress((Bytef*)text,&blen,(Bytef*)dest,1024);cout << text << endl;

http://www.wangmingla.cn/news/37183.html

相关文章:

  • 网站访问大小网络推广宣传方式
  • 电子商务网站建设说课稿搜索引擎营销的内容有哪些
  • 郑州做网站制作的公司推广赚钱app
  • 唐山网站制作app百度极速版app下载安装
  • 做盗版小说网站犯法吗龙岗seo优化
  • 可视化建网站佛山seo优化外包
  • 专业房地产网站建设国家免费职业技能培训官网
  • 山西网站建设费用潍坊网站建设优化
  • 襄阳做网站公司seo优化靠谱吗
  • 网站留言系统编写代码长春网络科技公司排名
  • 网站开发的目的意义上海百度推广电话
  • 网站建设简介是什么意思沈阳关键词快照优化
  • 徐州有哪些网站制作公司最新的疫情最新消息
  • 教学系统设计 网站开发百度手机快速排名点击软件
  • 做网站站主需要什么条件河南网络推广公司
  • 潍坊网站制作报价网络营销策划论文
  • 为某公司或企业做的门户网站地推团队联系方式
  • 安全质量报监建设局网站媒介
  • 网站建设代理网站网站优化seo推广服务
  • 广州兼职网网站建设制作网页的工具软件
  • 做的网站在百度找不到了大连网站搜索排名
  • 武汉建设银行网站互联网网站
  • 在郑州做网站自媒体135免费版下载
  • 网站建设的背景意义充电宝seo关键词优化
  • 如何做网站英文简历模板seo文章
  • 免费空间做网站软文推广网
  • 网站接做网站单seo营销的概念
  • 品牌网站建设策划成都seo优化排名公司
  • 博物馆网站建设上海专业的网络推广
  • 成都响应式网站深圳经济最新新闻