?? sptest.cpp
字號:
// Created:10-31-98
// By Jeff Connelly
// Spinning cursor example while encoding/decoding
// Compile: gcc sptest.cpp -o sptest.exe -lcompr
#include "comprlib.h"
// This is a custom function to read a byte
unsigned char spin_read_byte()
{
// The prototype for spin() is:
// void spin(int speed = 10, char chars[] = "|/-\\\0");
// speed The numbers of characters that must be read
// before the characters are spun. (1 in this example)
// chars[] The characters, in order, to spin, null-terminated
// (the default |/-\ is OK)
spin(1); // Spin after one character is read.
// Now actually read the byte
return ComprLibFileIO::read_byte();
}
int main(int argc, char* argv[])
{
// Set all of the I/O function pointers to file I/O
ComprLibFileIO::Set();
// Assign the function pointer to read a byte to our custom one
read_byte = spin_read_byte;
if (argc != 3)
{
printf ("Compresses a file using LZSS and displays a spinning cursor.\n"
"Syntax: SPTEST source dest\n"
"Example: sptest sptest.exe sptest.cmp");
exit (1);
}
ComprLibFileIO::source_file = fopen(argv[1], "rb");
ComprLibFileIO::dest_file = fopen(argv[2], "wb");
if (!ComprLibFileIO::source_file || !ComprLibFileIO::dest_file)
{
printf ("Failed to open file(s)\n");
exit (1);
}
printf ("The spinning cursor: ");
lzss_encode();
fclose(ComprLibFileIO::source_file);
fclose(ComprLibFileIO::dest_file);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -