close_reader


close_reader(s)
      

If the input stream s is not already closed, close it and return void. Once a stream is closed, no more input operations may be performed on it. Because the operating system may place limits on the number of file streams open at one time or restrict access to an open file, it is good practice to close any file stream that will no longer be used for input or output. Closing a stream that has already been closed has no effect.

Closing a string or byte array stream has no effect. As they consume no system resources, string and byte array streams can be safely reclaimed by the garbage collector.

Examples:


// reading a utf-8 encoded text file:
let t = transcoder('UTF_8)
let f = file_reader("greek.txt", transcoder = t)
let contents = read_all_chars(f)
close_reader(f)
      

Also see:

close_writer
is_reader


Core Module Index | Contents