[comp.lang.c++] ostream recipient class

tron1@tronsbox.xei.com (Kenneth Jamieson) (01/31/91)

	For various projects, I would like to be able to move from
some variable length C++ classes (like String) to a fixed length
buffer.

	By this I mean, for the SYS V "msg" system, I need take the
info in two or three strings , put them in a pre-allocated buffer and
then send the pointer to that to a function.

	So how do I overload the << operator to let me get the bytes
one at a time (so I can count them, check for overflow and so on)?

	I see something like ...




Buffer my_buf( 1024 );		/* Our theoretical Buffer class
				   told to allocate 1 k for buffering */

String foo = "This is a test";  /* A test string */

	my_buf << foo;		/* Put the string into my buffer */	


	You see ?? In this way , I could set up the max buffer to be,
say, 4k , use the stream stuff to fill it , the turn that over to the
message functions to play with.

	
-- 
========[ Xanadu Enterprises Inc. Amiga & Unix Software Development]=======
= "I know how you feel, you don't know if you want to hit me or kiss me - =
=  --- I get a lot of that."  Madonna as Breathless Mahoney (Dick Tracy)  =
=========== Ken Jamieson: uunet!tronsbox.xei.com!tron1  ===================
=     NONE of the opinions represented here are endorsed by anybody.      =
=== The Romantic Encounters BBS 201-759-8450(PEP) / 201-759-8568(2400) ====