xref: /third_party/zlib/contrib/iostream/test.cpp
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/zlib/contrib/iostream/
1275793eaSopenharmony_ci
2275793eaSopenharmony_ci#include "zfstream.h"
3275793eaSopenharmony_ci
4275793eaSopenharmony_ciint main() {
5275793eaSopenharmony_ci
6275793eaSopenharmony_ci  // Construct a stream object with this filebuffer.  Anything sent
7275793eaSopenharmony_ci  // to this stream will go to standard out.
8275793eaSopenharmony_ci  gzofstream os( 1, ios::out );
9275793eaSopenharmony_ci
10275793eaSopenharmony_ci  // This text is getting compressed and sent to stdout.
11275793eaSopenharmony_ci  // To prove this, run 'test | zcat'.
12275793eaSopenharmony_ci  os << "Hello, Mommy" << endl;
13275793eaSopenharmony_ci
14275793eaSopenharmony_ci  os << setcompressionlevel( Z_NO_COMPRESSION );
15275793eaSopenharmony_ci  os << "hello, hello, hi, ho!" << endl;
16275793eaSopenharmony_ci
17275793eaSopenharmony_ci  setcompressionlevel( os, Z_DEFAULT_COMPRESSION )
18275793eaSopenharmony_ci    << "I'm compressing again" << endl;
19275793eaSopenharmony_ci
20275793eaSopenharmony_ci  os.close();
21275793eaSopenharmony_ci
22275793eaSopenharmony_ci  return 0;
23275793eaSopenharmony_ci
24275793eaSopenharmony_ci}
25

Indexes created Thu Nov 07 10:32:03 CST 2024