📄 simple.cpp
字号:
// 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -