Skip to main content

FlushFile

This function was added in DSL 4

Description

Flush writing operations.

function FlushFile(file) --[[ ... ]] end

Parameters

  • file: userdata - The file handle to flush. This should be the same handle returned by OpenFile. If the file is not open for writing, this function does nothing.

Return Values

None.

Example

local file, bytes = OpenFile('data.txt', 'w')
if file then
WriteFile(file, 'Hello, world!')
FlushFile(file) -- Ensure all data is written to the file
CloseFile(file)
else
print('Failed to open file')
end

See Also