|
From: Gregor P. <Gre...@dl...> - 2000-12-07 11:22:09
|
Fine, but where to get strstream from? It isn't in iostream.h am I right? Are there any online documentation about stdlib.h, string.h & Co where I can browse for myself? Gregor Chad Simmons wrote: > >How to convert, cast, transform, whatever a int value to a string? > >include <string.h> > >string my1String = "John has"; string my2String = "apples!"; int myInt = 6; > >my1stString = my1stString + UNKNOWN_FUNC(myInt) + my2ndString; > >As you guessed I'd like to get: "John has 6 apples!" > > How about this instead.. > > string my1String = "John"; > string my2String = "apples"; > int myInt = 6; > strstream buffer; > > buffer << my1String << " has " << myInt << " "<< my2String << "!" << endl; > cout << buffer.str(); > // Output = John has 6 apples! |