unbuffer_file

unbuffer_file — causes a file to be treated as unbuffered on both input and output.

Syntax

unbuffer_file (file)

		

Arguments

file

A file pointer to a previously opened file. This may only be a file in the file system, and not a string opened for read and write.

Returns

The unbuffered file object on success, or nil on failure.

Description

This function causes a file to be treated as unbuffered on both input and output. The normal buffering mode of a file depends on whether it is in the file system, or to a character device such as a terminal or console.

When the file is unbuffered, all input and output to that file will occur immediately, without going through internal buffers. In general, an unbuffered file is much less efficient for file I/O. Unbuffering is temporary, as the file will revert to a buffered state when it is closed or reopened.

Example

Gamma> fu = open("mytestfile.dat","r",nil);
#<File:"mytestfile.dat">
Gamma> unbuffer_file(fu);
#<File:"mytestfile.dat">
Gamma>