⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sptest.cpp

📁 非常好用的五子棋游戏源码
💻 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 + -