Skip to content

OpenFile

Claude edited this page Oct 26, 2026 · 5 revisions

OpenFile

Command Index · BlitzBasic · Files

OpenFile filename$  ; returns Int

Works in: Blitz2D, BlitzPlus, Blitz3D

Opens an existing file for reading and writing at once, keeping what is in it. Use SeekFile to move around before you read or write.

file = WriteFile("files_open_example.tmp")
WriteByte file, 1
WriteByte file, 2
CloseFile file
file = OpenFile("files_open_example.tmp")
SeekFile file, 1
WriteByte file, 9
SeekFile file, 0
Print ReadByte(file)
Print ReadByte(file)
CloseFile file
DeleteFile "files_open_example.tmp"
1
9
Parameter Type Default Description
filename String required The file to open.

Returns: A file handle, or 0 when the file does not exist.

Related commands

Command Index · BlitzBasic · Files

Home · Command Index


Getting started

Language

Tools


Language Features
BlitzBasic
Blitz3D
BlitzPlus
Differences

Clone this wiki locally