Removed debugging detritus and fixed a typo.
[AROS.git] / test / seektest.c
blobfd4c790eeb466638af6c33064301a882a7570ad8
1 /*
2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <proto/dos.h>
7 #include <stdlib.h>
8 #include <stdio.h>
10 int main()
12 BPTR fh = BNULL;
13 int maxsize = 524288;
14 char * buffer = NULL;
15 int filepos = 0;
16 int writesize = 0;
18 buffer = malloc(maxsize);
20 printf("Enter writesize (< 524288)\n");
21 scanf("%d", &writesize);
23 fh = Open("seek_test_file", MODE_NEWFILE);
24 FWrite(fh, (STRPTR)buffer, writesize, 1);
25 Flush(fh);
26 printf("File pos: %d\n", (int)Seek(fh, 0, OFFSET_CURRENT));
27 filepos = Seek(fh, writesize, OFFSET_BEGINNING);
29 if (filepos == -1)
30 printf("ERROR for size: %d, IoErr: %d\n", (int)writesize, (int)IoErr());
31 else
32 printf("OK\n");
34 free(buffer);
36 Close(fh);
37 return 0;