Skip to content

Modern Fs File Open

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

Home › Filesystem › File Streams › File.Open

File.Open

Opens a file the way an OpenOptions says: read, write, append, create and more.

Syntax

File.Open( p, opts )

Notes

  • Opens p as opts says. See OpenOptions for the rules.
  • A directory is FS_IS_A_DIRECTORY.

Examples

#import "std/fs"
using fs

dim as ustring dir_ = CreateTempDir( "tkdoc" ).Value( )
dim as ustring p = PathJoin( dir_, "f.txt" )
dim as OpenOptions o = OpenOptionsWrite( )
dim as File f
print f.Open( p, o ).IsOk( )    '' true
f.Close( )

RemoveDirAll( dir_ )

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

Clone this wiki locally