Trust uboot's device list only if it does not look suspicious.
[AROS.git] / test / seektest.c
blobdff1c60313501e084c8c7f511cd498b4cb11adee
1 #include <proto/dos.h>
2 #include <stdlib.h>
3 #include <stdio.h>
5 int main()
7 BPTR fh = BNULL;
8 int maxsize = 524288;
9 char * buffer = NULL;
10 int filepos = 0;
11 int writesize = 0;
13 buffer = malloc(maxsize);
15 printf("Enter writesize (< 524288)\n");
16 scanf("%d", &writesize);
18 fh = Open("seek_test_file", MODE_NEWFILE);
19 FWrite(fh, (STRPTR)buffer, writesize, 1);
20 Flush(fh);
21 printf("File pos: %d\n", (int)Seek(fh, 0, OFFSET_CURRENT));
22 filepos = Seek(fh, writesize, OFFSET_BEGINNING);
24 if (filepos == -1)
25 printf("ERROR for size: %d, IoErr: %d\n", (int)writesize, (int)IoErr());
26 else
27 printf("OK\n");
29 free(buffer);
31 Close(fh);
32 return 0;