0

There are several ways to do this (I believe). But I simply want a stream that will get all my data and output it to console. I tried using a stringstream by setting the strinstream::out flag and then doing a cout on the str() member function, but it didn't work as I expected.

Example:

somestream myS;
myS.flags(ios::left);
myS<<data<<data<<data<<endl;

This will either automatically output to console or I will have to do it manually (Somehow). The data will always be formatted to what I set.

P.s.: I can't use printf, or boost.

Thanks for your attention

4

1 回答 1

0

sprintf 对于以有用的方式打印出字符串/空终止字符串很有用。它很旧,但它有效。它可以采用可变参数等。 sprintf (sprintf)

于 2012-05-21T04:58:16.853 回答