ReactOS 0.4.16-dev-2104-gb84fa49
fgetpos.cpp
Go to the documentation of this file.
1//
2// fgetpos.cpp
3//
4// Copyright (c) Microsoft Corporation. All rights reserved.
5//
6// Defines fgetpos(), which gets the file position in an opaque internal format.
7//
9
10
11
12// Gets the file position in the internal fpos_t format. The returned value
13// should only be used in a call to fsetpos(). Our implementation happens to
14// just wrap _ftelli64() and _fseeki64(). Return zero on success; returns -1
15// and sets errno on failure.
16extern "C" int __cdecl fgetpos(FILE* const stream, fpos_t* const position)
17{
18 _VALIDATE_RETURN(stream != nullptr, EINVAL, -1);
19 _VALIDATE_RETURN(position != nullptr, EINVAL, -1);
20
21 *position = _ftelli64(stream);
22 if (*position == -1)
23 return -1;
24
25 return 0;
26}
#define _VALIDATE_RETURN(expr, errorcode, retexpr)
__int64 CDECL _ftelli64(FILE *file)
Definition: file.c:4672
#define __cdecl
Definition: corecrt.h:121
#define EINVAL
Definition: errno.h:44
int __cdecl fgetpos(FILE *const stream, fpos_t *const position)
Definition: fgetpos.cpp:16
__int64 fpos_t
Definition: stdio.h:73
Definition: parse.h:23