source: trunk/libs/newlib/src/newlib/libc/stdio64/fgetpos64.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.7 KB
Line 
1/*
2FUNCTION
3<<fgetpos64>>---record position in a large stream or file
4
5INDEX
6        fgetpos64
7INDEX
8        _fgetpos64_r
9
10SYNOPSIS
11        #include <stdio.h>
12        int fgetpos64(FILE *<[fp]>, _fpos64_t *<[pos]>);
13        int _fgetpos64_r(struct _reent *<[ptr]>, FILE *<[fp]>,
14                         _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 <<fgetpos64>> to report on the current position for a file
22identified by <[fp]> that was opened by <<fopen64>>; <<fgetpos>> will write
23a value representing that position at <<*<[pos]>>>.  Later, you can
24use this value with <<fsetpos64>> to return the file to this
25position.
26
27In the current implementation, <<fgetpos64>> simply uses a character
28count to represent the file position; this is the same number that
29would be returned by <<ftello64>>.
30
31RETURNS
32<<fgetpos64>> returns <<0>> when successful.  If <<fgetpos64>> fails, the
33result is <<1>>.  Failure occurs on streams that do not support
34positioning or streams not opened via <<fopen64>>; the global <<errno>>
35indicates these conditions with the value <<ESPIPE>>.
36
37PORTABILITY
38<<fgetpos64>> is a glibc extension.
39
40No supporting OS subroutines are required.
41*/
42
43#include <stdio.h>
44
45#ifdef __LARGE64_FILES
46
47int
48_fgetpos64_r (struct _reent * ptr,
49        FILE * fp,
50        _fpos64_t * pos)
51{
52  *pos = (_fpos64_t)_ftello64_r (ptr, fp);
53
54  if (*pos != -1)
55    {
56      return 0;
57    }
58  return 1;
59}
60
61#ifndef _REENT_ONLY
62
63int
64fgetpos64 (FILE * fp,
65        _fpos64_t * pos)
66{
67  return _fgetpos64_r (_REENT, fp, pos);
68}
69
70#endif /* !_REENT_ONLY */
71
72#endif /* __LARGE64_FILES */
Note: See TracBrowser for help on using the repository browser.