#include #include #include #define SIZE 1000000 #define VALUE 1000000 #define BUF_SIZE 4096 #define DIGIT_SIZE 10 char buf[BUF_SIZE], digits[DIGIT_SIZE]; int pos; inline void putChar(FILE *f, char c) { buf[pos++] = c; if (pos == BUF_SIZE) { fwrite(buf, 1, BUF_SIZE, f); pos = 0; } } inline void writeInt(FILE *f, int x) { int n = 0, q; do { q = x / 10; digits[n++] = x - q * 10 + '0'; x = q; } while (x); while (n--) { putChar(f, digits[n]); } } inline void flush(FILE *f) { fwrite(buf, 1, pos, f); } int main(void) { srand(time(NULL)); FILE *f = fopen("parsare.out", "w"); for (int i = 0; i < SIZE; i++) { int x = rand() % VALUE; writeInt(f, x); putChar(f, '\n'); } flush(f); fclose(f); }