Path: blob/main/contrib/llvm-project/libcxx/src/fstream.cpp
35147 views
//===----------------------------------------------------------------------===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#include <__config>9#include <cstdio>10#include <fstream>1112#if defined(_LIBCPP_WIN32API)13# define WIN32_LEAN_AND_MEAN14# define NOMINMAX15# include <io.h>16# include <windows.h>17#endif1819_LIBCPP_BEGIN_NAMESPACE_STD2021#if defined(_LIBCPP_WIN32API)2223// Confirm that `HANDLE` is `void*` as implemented in `basic_filebuf`24static_assert(std::same_as<HANDLE, void*>);2526_LIBCPP_EXPORTED_FROM_ABI void* __filebuf_windows_native_handle(FILE* __file) noexcept {27// https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/get-osfhandle?view=msvc-17028intptr_t __handle = _get_osfhandle(fileno(__file));29if (__handle == -1)30return nullptr;31return reinterpret_cast<void*>(__handle);32}3334#endif3536_LIBCPP_END_NAMESPACE_STD373839