/* showgeiger.c */ #include #include char buffer[1024]; int main(int argc, char *argv[]) { FILE *f; printf("Content-type: text/html\n\n"); printf("\n"); printf("\n"); printf("\n"); printf("\n"); printf("ガイガーカウンタ\n"); printf("\n"); printf("\n"); printf("

ガイガーカウンタ

\n"); printf("

10分ごとのカウント値を表示しています。\n"); printf("

\n");
    if ((f = fopen("/usr/local/apache/htdocs/geiger.dat", "r")) != NULL) {
        if (fseek(f, (long)(-20 * 6 * 24 - 10), SEEK_END) == 0) {
            fgets(buffer, sizeof(buffer), f);
        } else {
            rewind(f);
        }
        while (fgets(buffer, sizeof(buffer), f) != NULL)
            fputs(buffer, stdout);
        fclose(f);
    }
    printf("
\n
\n\n\n"); return 0; }