close file

Closes a file that was opened with the open file command.

# Metadata

Platforms: desktop, server, mobile OS: mac, windows, linux, ios, android Introduced: 1.0 Security: disk

# Syntax

close file filePath

# Params

- filePath : The name and location of the file you want to close. If you specify a name but not a location, LiveCode assumes the file is in the defaultFolder.

# Examples

close file "/Desktop/Temp"

close file line 1 of the openFiles

open file (specialFolderPath("desktop") & "/text.txt") write "This is a test" \ to file (specialFolderPath("desktop") & "/text.txt" ) close file (specialFolderPath("desktop") & "/text.txt")

# Description

Use the close file command to release a file after reading from it or writing to it. (A file that is open for writing can't be used by any other application until you've closed the file.)

Any files you have opened are closed automatically when you quit the application. printer:(keyword), COMn: (keyword), LPT1: (keyword), serialControlString (property)

# Tags

# See

- **keyword:** file, modem: - **command:** write to file, close driver, open file, close, seek, read from file, delete file - **function:** openFiles, sysError - **glossary:** command