drain (file, drain_p)
This function sets a flag on the file state such that if the drain_p flag is on, the first time that a read on that file finds no characters waiting, the read will return immediately with "Unexpected end of file". This is intended for use in situations where the operating system may never actually generate an end of file indication, but where it is known that no more input will be available once a read would block. This function does not affect dev_read.
For best results, the file should be unbuffered first with unbuffer_file. Otherwise characters will be read in buffer by buffer and held locally in groups of 1024. This could cause a read function to return "Unexpected end of file" even when there are still characters waiting to be read.
Copyright © 1995-2010 by Cogent Real-Time Systems, Inc. All rights reserved.