Table of Contents

fclose

Description

Close a file handle.

Function prototype

bool fclose <voidptr:hFile>

Arguments

Name Type Comment
hFile voidptr A handle to a file that was previously opened by fopen or fopen_s.

Return value

False if:

True otherwise.

Example

voidptr fp // create a file handle
set fp <zs:fopen "C:\\test.txt" "w"> // open the file, and assign the value to 'fp'
assert fp "Cannot open file!" // exit if file can't be opened

string s
set string "Hello!"
fwrite fp s // write text to file

fclose fp // close file

Comments

None.

See also