simple.cpp

来自「非常好用的五子棋游戏源码」· C++ 代码 · 共 32 行

CPP
32
字号
// Created:10-31-98
// By Jeff Connelly

// A very simple test of compressing standard streams 'stdin' and 'stdout'.
// The error stream 'stderr' is used for messages.

// Compile: gcc simple.cpp -o simple.exe -lcompr

// Note: The standard streams are used, so binary file compression might not
//       work, plain text files should though.  Also, if this file seems
//       large, it is just because of the comments, look at SIMPLEC.CPP.

#include "comprlib.h"

int main()
{
    // Set the functions in 'ComprLibFileIO' class to the global I/O ones
    ComprLibFileIO::Set();

    // Set the source and dest files to the standard input and output
    // streams.  To compress a file, use 'fopen'.
    ComprLibFileIO::source_file = stdin;
    ComprLibFileIO::dest_file = stdout;

    fprintf (stderr, "Compressing stdin to stdout...\n");

    // Compress the streams using LZSS method.
    lzss_encode();
}

// That's right! Only 4 calls to ComprLib!

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?