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

📄 hstrip.cpp

📁 非常好用的五子棋游戏源码
💻 CPP
字号:
// Created:11-14-98
// By Jeff Connelly

// HStrip - Reduces the size of HTML documents

#include <stdio.h>
#include <stdlib.h>
#include <io.h>
#include <string.h>
#include <ctype.h>

bool iswhitespace(char c)
{
    switch (c)
    {
    case 0x0A:              // fall though
    case 0x0D:              // fall though
    case ' ':               // fall though
    case 0x09: return true;
    default: return false;
    };
}

// Reduces the size of HTML page 'in' to 'out'
void ReduceHTML(FILE* in, FILE* out)
{
    bool whitespace = false;
    register char c;
    
    while (!feof(in))
    {
        c = getc(in);
        if (iswhitespace(c))
            whitespace = true;
        else
        {
            if (whitespace)         // Whitespace was present
                fputc(' ', out);
            fputc(c, out);
            whitespace = false;
        }
    }
}

const char* help = "Reduces the size of an HTML page\n"
                   "\tHSTRIP source dest\n"
                   "\n";


int main(int argc, char* argv[])
{
    FILE* in;
    FILE* out;

    if (argc != 3)
    {
        printf(help);
        exit (0);
    }

    in = fopen(argv[1], "rt");
    out = fopen(argv[2], "wt");

    if (!in || !out)
    {
        printf ("Cannot open files(s)\n");
        exit (1);
    }

    printf ("Reducing size of %s...\n", argv[1]);

    ReduceHTML(in, out);
    return 0;
}

⌨️ 快捷键说明

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