CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2002
    Posts
    10

    Question Creating a stringbuffer...

    How do you create a buffer where i can add charachters to the buffer. I then want to put this sequence of characters (the buffer) into an element of an array and then put this array into an element of a vector?
    Last edited by Josh man; July 16th, 2002 at 12:31 PM.

  2. #2
    Join Date
    Mar 2002
    Location
    California
    Posts
    1,582
    Well, to start you out, you can use ostringstream.

    Code:
    #include <sstream>
    using namespace std;
    
    ...
    
    
    ostringstream ostr;
    ostr << "The answer is..." << 42 << endl;
    
    string strAnswer = ostr.str();
    Now, I'm sure there's an easy way to get it into a vector, although I've never done it.

    Jeff

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured