source: trunk/libs/newlib/src/newlib/libc/stdio64/fsetpos64.c @ 620

Last change on this file since 620 was 444, checked in by satin@…, 6 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 1.5 KB
Line 
1/*
2FUNCTION
3<<fsetpos64>>---restore position of a large stream or file
4
5INDEX
6        fsetpos64
7INDEX
8        _fsetpos64_r
9
10SYNOPSIS
11        #include <stdio.h>
12        int fsetpos64(FILE *<[fp]>, const _fpos64_t *<[pos]>);
13        int _fsetpos64_r(struct _reent *<[ptr]>, FILE *<[fp]>,
14                         const _fpos64_t *<[pos]>);
15
16DESCRIPTION
17Objects of type <<FILE>> can have a ``position'' that records how much
18of the file your program has already read.  Many of the <<stdio>> functions
19depend on this position, and many change it as a side effect.
20
21You can use <<fsetpos64>> to return the large file identified by <[fp]> to a
22previous position <<*<[pos]>>> (after first recording it with <<fgetpos64>>).
23
24See <<fseeko64>> for a similar facility.
25
26RETURNS
27<<fgetpos64>> returns <<0>> when successful.  If <<fgetpos64>> fails, the
28result is <<1>>.  The reason for failure is indicated in <<errno>>:
29either <<ESPIPE>> (the stream identified by <[fp]> doesn't support
3064-bit repositioning) or <<EINVAL>> (invalid file position).
31
32PORTABILITY
33<<fsetpos64>> is a glibc extension.
34
35Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
36<<lseek64>>, <<read>>, <<sbrk>>, <<write>>.
37*/
38
39#include <stdio.h>
40
41#ifdef __LARGE64_FILES
42
43int
44_fsetpos64_r (struct _reent *ptr,
45        FILE * iop,
46        const _fpos64_t * pos)
47{
48  int x = _fseeko64_r (ptr, iop, (_off64_t)(*pos), SEEK_SET);
49
50  if (x != 0)
51    return 1;
52  return 0;
53}
54
55#ifndef _REENT_ONLY
56
57int
58fsetpos64 (FILE * iop,
59        const _fpos64_t * pos)
60{
61  return _fsetpos64_r (_REENT, iop, pos);
62}
63
64#endif /* !_REENT_ONLY */
65
66#endif /* __LARGE64_FILES */
Note: See TracBrowser for help on using the repository browser.