Mercurial > foo_out_sdl
view foosdk/sdk/pfc/filehandle.cpp @ 1:20d02a178406 default tip
*: check in everything else
yay
| author | Paper <paper@tflc.us> |
|---|---|
| date | Mon, 05 Jan 2026 02:15:46 -0500 |
| parents | |
| children |
line wrap: on
line source
#include "pfc-lite.h" #include "filehandle.h" #ifndef _WIN32 #include <unistd.h> #endif namespace pfc { void fileHandleClose( fileHandle_t h ) noexcept { if (h == fileHandleInvalid) return; #ifdef _WIN32 CloseHandle( h ); #else close( h ); #endif } fileHandle_t fileHandleDup( fileHandle_t h ) { #ifdef _WIN32 auto proc = GetCurrentProcess(); HANDLE out; if (!DuplicateHandle ( proc, h, proc, &out, 0, FALSE, DUPLICATE_SAME_ACCESS )) return fileHandleInvalid; return out; #else return dup( h ); #endif } void fileHandle::close() noexcept { fileHandleClose( h ); clear(); } }
