Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!odi!benson From: benson@odi.com (Benson I. Margulies) Newsgroups: comp.lang.c++ Subject: Newline hook needed in streams Message-ID: <1989Dec18.132745.5187@odi.com> Date: 18 Dec 89 13:27:45 GMT Reply-To: benson@odi.com (Benson I. Margulies) Organization: Object Design Inc., Burlington, MA Lines: 18 I've needed to implement two special kinds of ostreams that seem to need "line buffering" support. That is, I need to have code of mine get control (via virtual function or function pointer) whenever a newline is inserted into the buffer. The two examples are an indenting stream (add a settable amount of indentation to the left margin) and a syslog stream. The indenting stream needs to know newline boundaries to know when to insert the indentation. The syslog stream wants to actually call syslog(3) for each line of output. Perhaps the next release of c++ could enhance the base classes (ios and streambuf) to have line buffering in addition to just plain buffering and non-buffering. -- Benson I. Margulies