Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uwm.edu!ux1.cso.uiuc.edu!news From: mlanett@ncsa.uiuc.edu (Mark Lanett) Newsgroups: comp.lang.c++ Subject: Re: String as input stream Message-ID: <1991Apr11.182026.28930@ux1.cso.uiuc.edu> Date: 11 Apr 91 18:20:26 GMT References: <2072@ac5.cs.nps.navy.mil> Sender: usenet@ux1.cso.uiuc.edu (News) Reply-To: mlanett@ncsa.uiuc.edu (Mark Lanett) Organization: University of Illinois at Urbana Lines: 22 In article , dagenais@siegfried.vlsi.polymtl.ca (Michel Dagenais) writes: > In libg++ there is an istream constructor which accepts a buffer as > argument instead of a file name. Sounds like the solution to your problem. > You can probably even redefine the internal underflow member function to > handle data buffered by chunks... like a long object spread several pages > in a disk BTREE implementation :-). > -- > --------------------------------------------------------------------------- > > Michel Dagenais dagenais@vlsi.polymtl.ca > Ecole Polytechnique de Montreal tel: (514) 340-4029 > > --------------------------------------------------------------------------- A better solution is the iostream library's strstreambuf. Use istrstream (buf, sizeof (buf)) and ostrstream (buf, sizeof (buf)) to create the strstreams. You can insert and extract from them as with istream and ostream.-- //----------------------------------------------------- Mark Lanett, mark-lanett@uiuc.edu NCSA, Software Tools Group, mlanett@ncsa.uiuc.edu