Skip to content

OpenFile

Narta Xaymar Dirks edited this page Oct 28, 2026 · 5 revisions

Blitz3DBlitzPlusBlitzBasic

OpenFile

OpenFile:Int32 filename:String
Parameter Mode Type Default Description
filename In String required The file to open.

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

Description

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.

Examples

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

Related Commands

CloseFile, CopyFile, DeleteFile, FilePos, NextFile, ReadFile, SeekFile, WriteFile

Home · Command Index



Differences
Language Features
BlitzBasic
Blitz3D
BlitzPlus

Clone this wiki locally