Hii

Using ftell() after fopen(..., "a") returns 0 even when the file open for 
appending is not empty. AFAIK, it should return the size of the file.

Compile and run the attached program several times to see it happening.

Cheers,

- Salva

Attachment: cygcheck.out
Description: Binary data

#include <stdio.h>

int main(int argc, char *argv[]) {
    FILE *f = fopen("file.out", "a");
    fprintf(stderr, "pos: %d\n", ftell(f));
    fprintf(f, "hello world\n");
    fprintf(stderr, "pos: %d\n", ftell(f));
    fclose(f);
}
--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

Reply via email to