dramstadt

  有的小说段落之间有大批的空行,看起来十分难看,比如:

  长达500多页,手动改就尴尬了,废话不多少,直接上代码:

#include "stdafx.h"
#include <stdio.h>
int main() {
    FILE * infile, * ofile;
    errno_t erri = fopen_s(&infile, "input.txt", "r");
    errno_t erro = fopen_s(&ofile, "output.txt", "w");
    char ch[2];
    int ptr = 0;
    ch[ptr] = fgetc(infile);
    while(ch[ptr] != EOF) {
        if(ch[ptr] == \'\n\') {
            if(ch[1 - ptr] == \'\n\') {}
            else {
                fputc(ch[ptr], ofile);
            }
        } else {
            fputc(ch[ptr], ofile);
        }
        ptr = 1 - ptr;
        ch[ptr] = fgetc(infile);
    }
    return 0;
}

把生成的TXT另存为PDF,这样就好看多了:

 

分类:

技术点:

相关文章:

  • 2021-12-15
  • 2022-12-23
  • 2022-01-03
  • 2021-12-01
  • 2022-12-23
  • 2021-12-05
  • 2021-12-05
  • 2022-12-23
猜你喜欢
  • 2022-02-09
  • 2022-12-23
  • 2021-07-31
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-15
相关资源
相似解决方案