2 Copyright © 1995-2003, The AROS Development Team. All rights reserved.
5 Change the position in a stream.
10 #include <proto/dos.h>
15 /*****************************************************************************
28 Change the current position in a stream.
31 stream - Modify this stream
32 offset, whence - How to modify the current position. whence
33 can be SEEK_SET, then offset is the absolute position
34 in the file (0 is the first byte), SEEK_CUR then the
35 position will change by offset (ie. -5 means to move
36 5 bytes to the beginning of the file) or SEEK_END.
37 SEEK_END means that the offset is relative to the
38 end of the file (-1 is the last byte and 0 is
42 0 on success and -1 on error. If an error occurred, the global
43 variable errno is set.
56 ******************************************************************************/
60 fdesc
*fdesc
= __getfdesc(stream
->fd
);
70 case SEEK_SET
: whence
= OFFSET_BEGINNING
; break;
71 case SEEK_CUR
: whence
= OFFSET_CURRENT
; break;
72 case SEEK_END
: whence
= OFFSET_END
; break;
79 fh
= (BPTR
)(fdesc
->fh
);
81 /* This is buffered IO, flush the buffer before any Seek */
83 cnt
= Seek (fh
, offset
, whence
);
86 errno
= IoErr2errno (IoErr ());