Thread: Length of a stringstream

  1. #1
    Banned nickname_changed's Avatar
    Join Date
    Feb 2003
    Location
    Australia
    Posts
    986

    Length of a stringstream

    Howdy,

    Simple question, how can I get the size of all the data stored in a stringstream instance? Eg:
    Code:
    stringstream Addresses;
    cout << Addresses.length() << endl;
    Where length() is the length of the data kept in the stringstream. I know length() isn't a member of stringstream, what other functions are there?

  2. #2
    Registered User jlou's Avatar
    Join Date
    Jul 2003
    Posts
    1,090
    I think your best bet is to check the length of the string it holds:
    Code:
    stringstream Addresses;
    cout << Addresses.str().length() << endl;

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. char Handling, probably typical newbie stuff
    By Neolyth in forum C Programming
    Replies: 16
    Last Post: 06-21-2009, 04:05 AM
  2. Strange string behavior
    By jcafaro10 in forum C Programming
    Replies: 2
    Last Post: 04-07-2009, 07:38 PM
  3. Replies: 3
    Last Post: 03-04-2005, 02:46 PM
  4. Weird modification to string length
    By ChwanRen in forum C Programming
    Replies: 0
    Last Post: 08-17-2003, 10:45 AM
  5. length of string etc.
    By Peachy in forum C Programming
    Replies: 5
    Last Post: 09-27-2001, 12:04 PM