Skip to content

Modern Fs File NativeHandle

Paul Squires edited this page Oct 22, 2026 · 3 revisions

Home › Filesystem › File Streams › File.NativeHandle

File.NativeHandle

Returns the operating-system handle or descriptor, or -1 when closed.

Syntax

File.NativeHandle( )

Notes

  • The HANDLE on Windows, the file descriptor on POSIX; -1 when closed. The File still owns it: do not close it yourself.

Examples

#import "std/fs"
using fs

dim as ustring dir_ = CreateTempDir( "tkdoc" ).Value( )
dim as ustring p = PathJoin( dir_, "f.txt" )
dim as File f
print f.NativeHandle( )    '' -1
f.Create( p )
print cbool( f.NativeHandle( ) <> -1 )    '' true
f.Close( )

RemoveDirAll( dir_ )

Library: Filesystem Library Category: File Streams Documented under: Files

Clone this wiki locally