Re: [C++] ostrstream vs. sprintf

From: Karl B Buchner (
Date: 02/07/02

> Of these, neither act or mudlog translate easily to a sane
> operator<<
> definition (it is doable with a bit of thought and patience to
> get
> it sane, though).
I already did this :)
        << = TO_CHAR
        >> = TO_NOT_VICT
        >   = TO_NOT_VICT regardless of invisibility
        <   = set victim for messages (excludes from TO_NOT_VICT
                messages and allows special codes (equiv. of $m $s)
All of these can be used for sending char *, int, or character * (in
case the character's name is sent)  also, char types can be used such as
ch < vict << "You give it to " <<  'M' << ".\r\n";
this would have the effect of
act("You give it to $M.", FALSE, ch, 0, vict, TO_CHAR);
Of course support for more than just char * and int could be for doubles may be added
as needed.  (now that I think about it matrix outputing would
be nice for my automap system)

> it is doable to use operator>> to read data from the descriptor, but
> in general we don't really need to know about this

I'm definitly not an expert on this (I only learned about stringstream
2 days ago), but I was under the impression that stringstream >>
had a effect similar to the atoi() family of functions:
int i;
float f;
ss  << "5 6.66"
ss >> i >> f;
would set i to 5 and f to 6.66....
Its quite possible that I'm wrong of course

Skizzik (w/ kicker),

Juno offers FREE or PREMIUM Internet access for less!
Join Juno today!  For your FREE software, visit:

   | FAQ: |
   | Archives: |
   | Newbie List:   |

This archive was generated by hypermail 2b30 : 06/25/03 PDT