Re: C++ question

From: Kenneth G. Cavness (kcavness@PROXICOM.COM)
Date: 08/06/97


>Hello All:
>
>In the source code, I know that there are lines similar to:
>
>    sprintf(buf, "Running game on port %d.", port);
>    log(buf);
>
>I do understand that the purpose of this is to build a string in buf, and
>then send it to the log function.  I'm currently working on porting the
>code to C++, and was wondering if anyone new of the corresponding C++
>equivalent to writing a stream to a buffer.  With the normal cout and cerr
>commands, the string is written out to screen immediately, instead of being
>stored in a buffer.

Actually, it's just a string literal. Write yourself a string class,
or use one of the ones provided all over the world. Then set your
logging class or method to accept a string as a parameter. That's
all the "buf" is -- a character array.

And it's a pretty good question, actually.

--
Kenneth G. Cavness
Washington, D.C.


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/08/00 PST