2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
14 #include <aros/debug.h>
16 /*****************************************************************************
29 Change the current position in a stream.
32 stream - Modify this stream
33 offset, whence - How to modify the current position. whence
34 can be SEEK_SET, then offset is the absolute position
35 in the file (0 is the first byte), SEEK_CUR then the
36 position will change by offset (ie. -5 means to move
37 5 bytes to the beginning of the file) or SEEK_END.
38 SEEK_END means that the offset is relative to the
39 end of the file (-1 is the last byte and 0 is
43 0 on success and -1 on error. If an error occurred, the global
44 variable errno is set.
47 The seek is handled by the files system so effects of what happens
48 when seeking after end of file may differ between file systems.
53 Not fully compatible with iso fseek, especially in 'ab' and 'a+b'
61 ******************************************************************************/
66 D(bug("[stdcio/fseek()] Entering stream=0x%x, offset=%d, whence=%d\n",
67 stream
, offset
, whence
73 mode
= OFFSET_BEGINNING
;
77 mode
= OFFSET_CURRENT
;
89 if (Seek(fh
, offset
, mode
) < 0)
91 D(bug("[stdcio/fseek()] Failed (IoErr()=%d)\n", IoErr()));
92 if (IoErr() == ERROR_UNKNOWN
)
95 errno
= __stdc_ioerr2errno(IoErr());
100 D(bug("[stdcio/fseek()] Done\n"));