Diferente pentru parsare-fisier-iesire intre reviziile #9 si #10

Nu exista diferente intre titluri.

Diferente intre continut:

using namespace std;
class OutParser
{
class OutParser {
private:
    FILE *fout;
    char *buff;
    int sp;
 
    void write_ch(char ch) {
        if (sp == 50000) {
            fwrite(buff, 1, 50000, fout);
            sp = 0;
            buff[sp++] = ch;
        } else {
            buff[sp++] = ch;
        }
    }
 
 
public:
    OutParser () {}
    OutParser (char *file_name) {output_file = fopen (file_name, "w"); memset (sir, 0, sizeof (sir));}
    OutParser &operator << (int val)
    {
        int cif[15];
        cif[0] = 0;
        if (val == 0) cif[0] = 1, cif[1] = 0;
        while (val) cif[++cif[0]] = val % 10, val /= 10;
        for (int i=cif[0]; i>=1; i--)
            sir[pos ++] = cif[i] + '0';
        if (pos >= max_l) CheckFinish ();
    OutParser(const char* name) {
        fout = fopen(name, "w");
        buff = new char[50000]();
        sp = 0;
    }
    ~OutParser() {
        fwrite(buff, 1, sp, fout);
        fclose(fout);
    }
 
    OutParser& operator << (int vu32) {
        if (vu32 <= 9) {
            write_ch(vu32 + '0');
        } else {
            (*this) << (vu32 / 10);
            write_ch(vu32 % 10 + '0');
        }
        return *this;
    }
    OutParser &operator << (char c)
    {
        sir[pos ++] = c;
        if (pos >= max_l) CheckFinish ();
 
    OutParser& operator << (long long vu64) {
        if (vu64 <= 9) {
            write_ch(vu64 + '0');
        } else {
            (*this) << (vu64 / 10);
            write_ch(vu64 % 10 + '0');
        }
        return *this;
    }
    OutParser &operator << (char *str)
    {
        while (*str)
        {
            sir[pos ++] = *str, str ++;
            if (pos >= max_l) CheckFinish ();
 
    OutParser& operator << (char ch) {
        write_ch(ch);
        return *this;
    }
    OutParser& operator << (const char *ch) {
        while (*ch) {
            write_ch(*ch);
            ++ch;
        }
        return *this;
    }
    ~OutParser () {fprintf (output_file, "%s", sir);}
private:
    FILE *output_file;
    static const int max_l = 50000;
    int pos = 0;
    char sir[max_l + 20];
    void CheckFinish () {fprintf (output_file, "%s", sir), pos = 0, memset (sir, 0, sizeof (sir));}
};
==

Nu exista diferente intre securitate.

Topicul de forum nu a fost schimbat.