[comp.lang.c++] Stream library

srs@ticnj.UUCP (Scott Strool) (03/21/91)

I am trying to use the 2.0 streams library to implement a simple scanf type
routine. Basically I have an array of characters from an istream and want to
parse the array delimited by the colon. The array has several fields and I 
want to get each into its own variable. How is this done with istrstream.
I can get istrstream to read an entire line but how do you tell istrstream
to read until a specific character or a predetermined length.


-- 
Scott Strool      	(908) 747-4700		srs@iex.com	
IEX Corporation
125 Half Mile Rd.	"Strange but not a Stranger"
Red Bank, NJ 07701

steve@taumet.com (Stephen Clamage) (03/24/91)

srs@ticnj.UUCP (Scott Strool) writes:


>I can get istrstream to read an entire line but how do you tell istrstream
>to read until a specific character or a predetermined length.

Use
	getline(char* ptr, int len, char delim);
This reads up to len characters or to the delimiter, whichever comes
first.
-- 

Steve Clamage, TauMetric Corp, steve@taumet.com