- Wrap change of entries in an InitChange/ExitChange pair (without this,
[AROS.git] / compiler / stdc / fgetpos.c
blobb8bf34ee83c8e7d21d243730ecace61dd08b2312
1 /*
2 Copyright © 1995-2012, The AROS Development Team. All rights reserved.
3 $Id$
5 C99 function fgetpos()
6 */
7 #include <errno.h>
9 /*****************************************************************************
11 NAME */
12 #include <stdio.h>
14 int fgetpos (
16 /* SYNOPSIS */
17 FILE * stream,
18 fpos_t * pos)
20 /* FUNCTION
21 Get the current position in a stream. This function is eqivalent
22 to ftell(). However, on some systems fpos_t may be a complex
23 structure, so this routine may be the only way to portably
24 get the position of a stream.
26 INPUTS
27 stream - The stream to get the position from.
28 pos - Pointer to the fpos_t position structure to fill.
30 RESULT
31 0 on success and -1 on error. If an error occurred, the global
32 variable errno is set.
34 NOTES
36 EXAMPLE
38 BUGS
40 SEE ALSO
41 fsetpos()
43 INTERNALS
45 ******************************************************************************/
47 if ( pos == NULL )
49 errno = EINVAL;
50 return -1;
53 *pos = ftell (stream);
55 if ( *pos < 0 )
57 return -1;
60 return 0;
61 } /* fgetpos */