stringstreams

This is a discussion on stringstreams within the C++ Programming forums, part of the General Programming Boards category; I need to insert a character array to be part of string stream, but when I output the stream, the ...

  1. #1
    Registered User
    Join Date
    Aug 2004
    Posts
    20

    stringstreams

    I need to insert a character array to be part of string stream, but when I output the stream, the array does not appear as it was typed. It comes out as weird characters. This is basically what the code is doing.

    Code:
    char word[4];
    strinstream sentence;
    cin >> word;
    
    sentence << "blah blah blah" << word << "blah blah";
    cout << sentence.str().c_str();

  2. #2
    Registered User
    Join Date
    Aug 2004
    Posts
    20
    figured it out i think. Sorry to bother.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A problem with loops and Stringstreams
    By mintsmike in forum C++ Programming
    Replies: 1
    Last Post: 03-28-2009, 12:08 PM
  2. stringstreams problem
    By Mostly Harmless in forum C++ Programming
    Replies: 1
    Last Post: 06-11-2007, 10:13 PM
  3. StringStreams
    By Scarvenger in forum C++ Programming
    Replies: 4
    Last Post: 01-11-2007, 11:32 PM
  4. stringstreams
    By Victor4015 in forum C++ Programming
    Replies: 1
    Last Post: 11-16-2005, 05:01 PM
  5. stringstreams help i know you guys will know
    By sswaters in forum C++ Programming
    Replies: 7
    Last Post: 10-22-2005, 08:46 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21