core :: FileReader :: reopen
The original path is reused, therefore the reopened file can be a different file.
var f = new FileReader.open("/etc/issue")
var l = f.read_line
f.reopen
assert l == f.read_line
# Open the same file again.
# The original path is reused, therefore the reopened file can be a different file.
#
# var f = new FileReader.open("/etc/issue")
# var l = f.read_line
# f.reopen
# assert l == f.read_line
fun reopen
do
var fl = _file
if fl != null and not fl.address_is_null then close
last_error = null
_file = new NativeFile.io_open_read(path.as(not null).to_cstring)
if _file.as(not null).address_is_null then
last_error = new IOError("Cannot open `{path.as(not null)}`: {sys.errno.strerror}")
return
end
end
lib/core/file.nit:107,2--124,4