Removed extraneous file description.
[cake.git] / test / seektest.c
blob9bafa70c3903ab9db02d90f81a42d6f7d0783a44
1 #include <proto/dos.h>
2 #include <stdlib.h>
3 #include <stdio.h>
5 int main()
7 BPTR fh = NULL;
8 int maxsize = 524288;
9 char * buffer = NULL;
10 int i = 0;
11 int filepos = 0;
12 int writesize = 0;
14 buffer = malloc(maxsize);
16 printf("Enter writesize (< 524288)\n");
17 scanf("%d", &writesize);
19 fh = Open("seek_test_file", MODE_NEWFILE);
20 FWrite(fh, (STRPTR)buffer, writesize, 1);
21 Flush(fh);
22 printf("File pos: %d\n", Seek(fh, 0, OFFSET_CURRENT));
23 filepos = Seek(fh, writesize, OFFSET_BEGINNING);
25 if (filepos == -1)
26 printf("ERROR for size: %d, IoErr: %d\n", writesize, IoErr());
27 else
28 printf("OK\n");
30 free(buffer);
32 Close(fh);
33 return 0;