suve

awful: function: f-close

Available since rev.36 (v.0.5.0).

Declaration

int :f-close ( file $FILE, … )

Summary

Closes any number of previously opened files. Until the files are open, no other program can access them (it's not even possible to reopen them with another :f-open call), so it is important to close files if you plan on sharing them during script run. No further operations should be done on closed files (although the variables themselves can be reused with another :f-open call).

Returns the number of files successfully closed.

Example

# :f-close example
!const =PATH s'example.txt'
:writeln s"Let's take a peek into ' =PATH s", shall we?"
 
# Open file, read first line and print it
:set &f :f-reset =PATH
:writeln :f-getln $f
 
# Close the file
:f-close $f

wikipage modified on 2014/0609/2301