OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [newlib-1.17.0/] [newlib/] [libc/] [stdio64/] [fgetpos64.c] - Blame information for rev 864

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 148 jeremybenn
/*
2
FUNCTION
3
<<fgetpos64>>---record position in a large stream or file
4
 
5
INDEX
6
        fgetpos64
7
INDEX
8
        _fgetpos64_r
9
 
10
ANSI_SYNOPSIS
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
 
16
TRAD_SYNOPSIS
17
        #include <stdio.h>
18
        int fgetpos64(<[fp]>, <[pos]>)
19
        FILE *<[fp]>;
20
        _fpos64_t *<[pos]>;
21
 
22
        int _fgetpos64_r(<[ptr]>, <[fp]>, <[pos]>)
23
        FILE *<[fp]>;
24
        _fpos64_t *<[pos]>;
25
 
26
DESCRIPTION
27
Objects of type <<FILE>> can have a ``position'' that records how much
28
of the file your program has already read.  Many of the <<stdio>> functions
29
depend on this position, and many change it as a side effect.
30
 
31
You can use <<fgetpos64>> to report on the current position for a file
32
identified by <[fp]> that was opened by <<fopen64>>; <<fgetpos>> will write
33
a value representing that position at <<*<[pos]>>>.  Later, you can
34
use this value with <<fsetpos64>> to return the file to this
35
position.
36
 
37
In the current implementation, <<fgetpos64>> simply uses a character
38
count to represent the file position; this is the same number that
39
would be returned by <<ftello64>>.
40
 
41
RETURNS
42
<<fgetpos64>> returns <<0>> when successful.  If <<fgetpos64>> fails, the
43
result is <<1>>.  Failure occurs on streams that do not support
44
positioning or streams not opened via <<fopen64>>; the global <<errno>>
45
indicates these conditions with the value <<ESPIPE>>.
46
 
47
PORTABILITY
48
<<fgetpos64>> is a glibc extension.
49
 
50
No supporting OS subroutines are required.
51
*/
52
 
53
#include <stdio.h>
54
 
55
#ifdef __LARGE64_FILES
56
 
57
int
58
_DEFUN (_fgetpos64_r, (ptr, fp, pos),
59
        struct _reent * ptr _AND
60
        FILE * fp _AND
61
        _fpos64_t * pos)
62
{
63
  *pos = (_fpos64_t)_ftello64_r (ptr, fp);
64
 
65
  if (*pos != -1)
66
    {
67
      return 0;
68
    }
69
  return 1;
70
}
71
 
72
#ifndef _REENT_ONLY
73
 
74
int
75
_DEFUN (fgetpos64, (fp, pos),
76
        FILE * fp _AND
77
        _fpos64_t * pos)
78
{
79
  return _fgetpos64_r (_REENT, fp, pos);
80
}
81
 
82
#endif /* !_REENT_ONLY */
83
 
84
#endif /* __LARGE64_FILES */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.