diff options
author | Sathyanarayanan Gunasekaran <gsathya.ceg@gmail.com> | 2014-06-11 17:09:25 -0700 |
---|---|---|
committer | Sathyanarayanan Gunasekaran <gsathya.ceg@gmail.com> | 2014-06-11 17:29:33 -0700 |
commit | 00a321f5955538dd9eef324901d7e3126600ddaa (patch) | |
tree | 8bca55c131a0c28e475c16e498a0996e0ffb0f26 /tests/fs/test_append.c | |
parent | fc553d898adb0cce80e25cc3ba0be6ba5eb5dbc1 (diff) |
add test case for checking file append
Diffstat (limited to 'tests/fs/test_append.c')
-rw-r--r-- | tests/fs/test_append.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/fs/test_append.c b/tests/fs/test_append.c new file mode 100644 index 00000000..27909ba3 --- /dev/null +++ b/tests/fs/test_append.c @@ -0,0 +1,24 @@ +#include<assert.h> +#include<stdio.h> + +int main (int argc, char *argv[]) +{ + FILE *fp; + int res; + long len; + + fp = fopen("testappend", "wb+"); + res = fwrite("1234567890", 10, 1, fp); + fclose(fp); + + fp = fopen("testappend", "ab+"); + res = fwrite("1234567890", 10, 1, fp); + + fseek(fp, -7, SEEK_END); + len = ftell(fp); + assert(len == 13); + fclose(fp); + + puts("success"); + return 0; +} |