tail.c

tmi2_fluffos_v2/lib/adm/simul_efun/tail.c · 306 B

From the archive tmi2_fluffos_v2.zip

Download the archive   « Back to the archive contents

int tail(string file) {
    string str;
    int diff;

    diff = file_size(file);
    if (diff < 0) return 0;

    diff -= 1024;
    if (diff < 0) diff = 0;
    str = read_bytes(file, diff, 1024);
    if (!str) return 0;
    if (diff) str = str[strsrch(str, "\n")+1..];

    write(str);

    return 1;
}

Site Stats

Snippets: 1791
Codebases: 571