Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
test.cc
Package: zlib124.zip [view]
Upload User: shengde
Upload Date: 2021-02-21
Package Size: 638k
Code Size: 1k
Category:
Compress-Decompress algrithms
Development Platform:
Visual C++
- /*
- * Test program for gzifstream and gzofstream
- *
- * by Ludwig Schwardt <schwardt@sun.ac.za>
- * original version by Kevin Ruland <kevin@rodin.wustl.edu>
- */
- #include "zfstream.h"
- #include <iostream> // for cout
- int main() {
- gzofstream outf;
- gzifstream inf;
- char buf[80];
- outf.open("test1.txt.gz");
- outf << "The quick brown fox sidestepped the lazy caninen"
- << 1.3 << "nPlan " << 9 << std::endl;
- outf.close();
- std::cout << "Wrote the following message to 'test1.txt.gz' (check with zcat or zless):n"
- << "The quick brown fox sidestepped the lazy caninen"
- << 1.3 << "nPlan " << 9 << std::endl;
- std::cout << "nReading 'test1.txt.gz' (buffered) produces:n";
- inf.open("test1.txt.gz");
- while (inf.getline(buf,80,'n')) {
- std::cout << buf << "t(" << inf.rdbuf()->in_avail() << " chars left in buffer)n";
- }
- inf.close();
- outf.rdbuf()->pubsetbuf(0,0);
- outf.open("test2.txt.gz");
- outf << setcompression(Z_NO_COMPRESSION)
- << "The quick brown fox sidestepped the lazy caninen"
- << 1.3 << "nPlan " << 9 << std::endl;
- outf.close();
- std::cout << "nWrote the same message to 'test2.txt.gz' in uncompressed form";
- std::cout << "nReading 'test2.txt.gz' (unbuffered) produces:n";
- inf.rdbuf()->pubsetbuf(0,0);
- inf.open("test2.txt.gz");
- while (inf.getline(buf,80,'n')) {
- std::cout << buf << "t(" << inf.rdbuf()->in_avail() << " chars left in buffer)n";
- }
- inf.close();
- return 0;
- }