Restored work-around for hangs when trying to use disk-based handlers
[tangerine.git] / compiler / clib / fgetpos.c
blob3daf42862ec5204a353fcd5fb50b489a83a7dea7
1 /*
2 Copyright © 1995-2003, The AROS Development Team. All rights reserved.
3 $Id$
5 Get the position in a stream.
6 */
8 #define fgetpos fgetpos
10 #include <errno.h>
12 /*****************************************************************************
14 NAME */
15 #include <stdio.h>
17 int fgetpos (
19 /* SYNOPSIS */
20 FILE * stream,
21 fpos_t * pos)
23 /* FUNCTION
24 Get the current position in a stream. This function is eqivalent
25 to ftell(). However, on some systems fpos_t may be a complex
26 structure, so this routine may be the only way to portably
27 get the position of a stream.
29 INPUTS
30 stream - The stream to get the position from.
31 pos - Pointer to the fpos_t position structure to fill.
33 RESULT
34 0 on success and -1 on error. If an error occurred, the global
35 variable errno is set.
37 NOTES
39 EXAMPLE
41 BUGS
43 SEE ALSO
44 fsetpos()
46 INTERNALS
48 ******************************************************************************/
50 if ( pos == NULL )
52 errno = EINVAL;
53 return -1;
56 *pos = ftell (stream);
58 if ( *pos < 0L )
60 return -1;
63 return 0;
64 } /* fgetpos */