tools/adflib: build only host variant which is used by Sam440 target
[AROS.git] / test / dos / seektest.c
blob0f576c0c3f56bc1802ab6f750490bf3de80fce0c
1 /*
2 Copyright © 1995-2015, 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 filepos == -1 ? RETURN_ERROR : RETURN_OK;