?? hstrip.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 + -