tools/crosstools/gcc-4.8.3: Fix m68k compilation (missing div/mul helpers in libgcc.a)
[AROS.git] / test / fileseek.c
blob8d06649d5a6ed1b8af0de6682ab6da69fe6e3654
1 /*
2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <stdio.h>
7 #include <proto/dos.h>
8 #include <dos/dos.h>
9 #include <stdlib.h>
11 int main()
13 FILE *fd;
14 char buffer[32];
15 int i;
16 BPTR file;
18 fd = fopen( "seek.txt", "wb" );
19 if ( !fd )
21 fprintf( stderr, "Could not write test file seek.txt\n" );
22 exit(-1);
24 fprintf( fd, "() does not work!\n" );
25 fclose(fd);
27 /* fseek() */
28 fd = fopen( "seek.txt", "rb" );
29 if ( !fd )
31 fprintf( stderr, "Could not open test file seek.txt\n" );
32 exit(-1);
34 i = fread( buffer, 1, 1, fd );
35 //printf("pos=%ld\n",ftell(fd));
36 i += fread( &buffer[1], 1, 6, fd );
37 if( i != 7 )
39 fprintf( stderr, "Wanted to fread() %d chars, but could only get %d!\n", 6, i-1 );
40 exit(-1);
42 fseek( fd, 4, SEEK_CUR );
43 i = fread( &buffer[7], 1, 11, fd );
44 buffer[7+i]=0;
45 printf( "fseek%s", buffer );
46 fclose(fd);
48 /* Seek() */
49 file = Open( "seek.txt", MODE_OLDFILE );
50 i = Read( file, buffer, 7 );
51 Seek( file, 4, OFFSET_CURRENT );
52 i += Read( file, &buffer[7], 11 );
53 buffer[i] = 0;
54 printf( "\nSeek%s", buffer );
56 return 0;