Comment detail

条件を満たす行を取り除く (Nested Flatten)
何の変哲もないですが・・・
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <iostream>
#include <fstream>

void convert(const char* input, const char* output)
{
    std::ifstream fin(input);

    if (fin)
    {
        std::ofstream fout(output);

        std::string s;

        while (std::getline(fin, s))
        {
            if (s.empty() || s[0] != '#')
            {
                fout << s << std::endl;
            }
        }
    }
}

int main(int argc, char* argv[])
{
    if (argc != 3)
    {
        std::cerr << "usage: input output" << std::endl;

        return -1;
    }

    convert(argv[1], argv[2]);

    return 0;
}

Index

Feed

Other

Link

Pathtraq

loading...