]> pd.if.org Git - pdclib/blob - functions/stdio/_PDCLIB_seek.c
PDCLib includes with quotes, not <>.
[pdclib] / functions / stdio / _PDCLIB_seek.c
1 /* int64_t _PDCLIB_seek( FILE *, int64_t, int )\r
2 \r
3    This file is part of the Public Domain C Library (PDCLib).\r
4    Permission is granted to use, modify, and / or redistribute at will.\r
5 */\r
6 \r
7 #include <stdio.h>\r
8 #include <stdint.h>\r
9 #include <errno.h>\r
10 #ifndef REGTEST\r
11 #include "_PDCLIB_io.h"\r
12 \r
13 int_fast64_t _PDCLIB_seek( FILE * stream, \r
14                            int_fast64_t offset, \r
15                            int whence )\r
16 {\r
17     int_fast64_t newPos;\r
18     if(!stream->ops->seek(stream->handle, offset, whence, &newPos)) {\r
19         return EOF;\r
20     }\r
21 \r
22     stream->ungetidx = 0;\r
23     stream->bufidx = 0;\r
24     stream->bufend = 0;\r
25     stream->pos.offset = newPos;\r
26     return newPos;\r
27 }\r
28 \r
29 #endif\r
30 \r
31 #ifdef TEST\r
32 #include "_PDCLIB_test.h"\r
33 \r
34 int main( void )\r
35 {\r
36     /* Testing covered by ftell.c */\r
37     return TEST_RESULTS;\r
38 }\r
39 \r
40 #endif\r
41 \r