Skip to content

WriteFile

Claude edited this page Oct 27, 2026 · 7 revisions

WriteFile

Command Index · BlitzBasic · Files

Command Syntax

WriteFile:Int32 filename:String

Description

Works in: Blitz2D, BlitzPlus, Blitz3D

Creates a file for writing. A file that already exists is emptied first.

Parameters

Parameter Type Default Description
filename String required The file to create.

Returns: A file handle, or 0 when the file cannot be created.

Examples

file = WriteFile("files_write_example.tmp")
WriteLine file, "first"
WriteLine file, "second"
CloseFile file
file = ReadFile("files_write_example.tmp")
Print ReadLine$(file)
Print ReadLine$(file)
CloseFile file
DeleteFile "files_write_example.tmp"
first
second

Related Commands

Command Index · BlitzBasic · Files

Home · Command Index


Getting started

Language

Tools


Language Features
BlitzBasic
Blitz3D
BlitzPlus
Differences

More

Clone this wiki locally