[comp.lang.c++] Is there an sprintf equivalent in iostream.h ?

emuleomo@paul.rutgers.edu (Emuleomo) (10/22/90)

Hi world,

	I have been trying to find an sprintf equivalent in <iostream.h> to no
	avail.  
	ostrstream buf; doesn't seem to do it 
	because once you do buf.str() you are stuck and you can't do 
	formatting to that buffer any more!

	char buf[254];
	ostrstream strbuf(buf, sizeof(buf), ios::out)

	doesn't quite do it either, because you need to stuff like
	strbuf.seekp( ios::beg) 
	in order to reuse buf and even when you 'write' to buf you will
	have to make sure that you terminate your writes with a NULL or you
	will be surprised when you attempt to access buf!!

	Luckily, TurboC++ allows me to mix and match <stdio.h> and <iostream.h>;
	however, is this generally the case?  i.e. will I get into trouble 
	using  sprintf and printf with  cout <<  and cin >> in other C++ 
	implementations such as cfront etc...

	E-mail will be *mucho* appreciated!

	ThanX

	--Emuleomo O.O. (emuleomo@yes.rutgers.edu)
-- 
Remember! It doesn't matter if you win or lose, as long as you win!