Thread: Viewing a buffer when using std::string advice.

  1. #1
    Registered User
    Join Date
    Aug 2007
    Location
    U.K.
    Posts
    148

    Viewing a buffer when using std::string advice.

    I have a task to do about the std::string datatype.

    To do the task I need to use the KDevelop IDE and be able to find the size of the buffer being used when performing operations upon strings, but never having used KDevelop before, I'm at a complete loss.

    Could anyone be so kind as to give me some direction as how to go about viewing a buffer which is in use? Can it's contents be viewed within a window of the IDE, or would I have to call functions to 'cout' details about the buffer being used?

    I'm at a complete loss about this, so any info is really appreciated.

    Many many thanks.

  2. #2
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    I'm not sure how an IDE would give you much insight into the innerworkings of an STL container - it sounds to me that you're a bit confused, honestly. But generally speaking, you can 'view' an std::string by passing it to the cout object, and get the size with, well, the size( ) member function.

  3. #3
    Registered User
    Join Date
    Aug 2007
    Location
    U.K.
    Posts
    148
    Yes, seems I was Sebastiani.

    Your advice was most helpful though.

    Many thanks.

  4. #4
    Unregistered User Yarin's Avatar
    Join Date
    Jul 2007
    Posts
    2,158
    You mentioned manipulating the string. STL string manipulation isn't done as it is in C, you can read about it here: C++ Reference
    You can use the c_str() member to get a C style string if you need to (non-manipulative, though).

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Lost with wrong output
    By erasm in forum C Programming
    Replies: 8
    Last Post: 10-06-2009, 06:44 AM
  2. Function call from another .c module
    By Ali.B in forum C Programming
    Replies: 14
    Last Post: 08-03-2009, 11:45 AM
  3. Print out a buffer
    By SwarfEye in forum C Programming
    Replies: 4
    Last Post: 09-08-2006, 09:32 AM
  4. writing a pack-style function, any advices?
    By isaac_s in forum C Programming
    Replies: 10
    Last Post: 07-08-2006, 08:09 PM
  5. buffer contents swapping
    By daluu in forum C++ Programming
    Replies: 7
    Last Post: 10-14-2004, 02:34 PM