indent std::cout ?
Posted on 1998-12-06
is there a way to produce indented text with std::cout? I want to be able to do something like this:
std::cout << "text (normal indentation).\n";
std::cout << indent(4) << "text indented by 4 spaces\nwhich also wraps lines.\n";
std::cout << "normal text again.\n";
text (normal indentation).
text indented by 4 spaces
which also wraps lines.
normal text again.
I know this is easy if I specifically state '\n', but can I indent text which virtually wraps after, say 80 characters (but not in the middle of a word)?
is this possible in C++ with STL libraries? if not, how would I implement this. If someone helps me with the implementaion, I will raise points!!!