per page, with , order by , clip by
Results of 1 - 1 of about 1 for debug (0.000 sec.)
Fixing a hole where the rain gets in (loglines.c)
#score: 9414
@digest: 02a27806c21670702c4fda714285bccd
@id: 1522
@lang: en
@size: 2139
@type: text/html
content-type: text/html; charset=UTF-8
viewport: width=device-width, initial-scale=1
#keywords: charsperline (37794), fprintf (37513), ftell (28223), logfile (24510), logfilename (22676), stderr (18705), perror (15630), 5ld (15368), ret (14647), truncexp (13442), writing (10776), fp (10731), sfreview (8724), 9ld (7815), fflush (7815), long (7762), include (7626), null (7230), calc (7107), count (6953), position (6273), loglines (6024), explanation (5755), failed (4869), char (3387), int (2373), line (2268), full (2083), rudhar (1799), http (1430), copyright (1354), 2014 (1316)
/* Copyright 2014 by R. Harmsen. For a full explanation see http://rudhar.com/sfreview/truncexp/en.htm */ #include <stdio.h> #include <stdlib.h> #include <unistd.h> char *logfilename = "logfile"; int main (int argc, char **argv) { long int i; FILE *fp; int ret, charsperline = 60; if ((fp = fopen(logfilename, /* "w" */ "a")) == NULL) { fprintf(stderr, "Could not open %s for writing\n", logfilename); perror(NULL); exit(1); } for (i = 0; i < 600; i++) { if ((ret = fprintf(fp, "Writing a line to the logfile, count = %5ld (calc'd: %5ld), position = %9ld\n", (long)i, (long)(ftell(fp) / charsperline), (long)ftell(fp))) < 0) { fprintf(stderr, "Fprintf failed, ret = %d\n", ret); perror(NULL); } else { charsperline = ret; } } fflush(fp); for (; i < 600 + 100 * 60; i++) { #ifdef DEBUG fprintf(stderr, "Writing a line to the logfile, count = %5ld (calc'd: %5ld), position = %9ld\n", (long)i, (long)(ftell(fp) / charsperline), (long)ftell(fp)); #endif if ((ret = fprintf(fp, "Writing a line to the logfile, count = %5ld (calc'd: %5ld), position = %9ld\n", (long)i, (long)(ftell(fp) / charsperline), (long)ftell(fp))) < 0) { fprintf(stderr, "Fprintf failed, ret = %d\n", ret); perror(NULL); } fflush(fp); sleep(10); } return 0; } /* Copyright 2014 by R. Harmsen. For a full explanation see http://rudhar.com/sfreview/truncexp/en.htm */ ...
https://rudhar.com/sfreview/truncexp/loglines.htm - [detail] - [similar]
PREV NEXT
Powered by Hyper Estraier 1.4.13, with 1747 documents and 81086 words.