HEX
Server: Apache
System: Linux srv1.prosuiteplus.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: prosuiteplus (1001)
PHP: 8.3.20
Disabled: NONE
Upload Files
File: //proc/597785/root/usr/share/doc/re2c/examples/17_ifstream.i--input(custom).re
#include <fstream>

static void conv(std::ifstream &in, std::ofstream &out)
{
    std::streampos mar;
#   define YYCTYPE     char
#   define YYPEEK()    in.peek()
#   define YYSKIP()    do { in.ignore(); if (in.eof()) return; } while(0)
#   define YYBACKUP()  mar = in.tellg()
#   define YYRESTORE() in.seekg(mar)
loop:
    /*!re2c
        re2c:yyfill:enable = 0;

        *      { out.put(yych); goto loop; }
        "\r\n" { out.put('\n'); goto loop; }
    */
}

int main(int argc, char **argv)
{
    if (argc != 3) return 1;

    std::ifstream in(argv[1], std::ios::binary);
    std::ofstream out(argv[2], std::ios::binary);
    if (in.fail() || out.fail()) return 2;

    conv(in, out);
    return 0;
}