Reactos
at master 26 lines 761 B view raw
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// 8#include <corecrt_internal_stdio.h> 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}