Results 1 to 2 of 2

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

  1. #1
    Join Date
    Jan 2007
    Beans
    171

    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
    Join Date
    Jun 2007
    Location
    Maryland, US
    Beans
    6,273
    Distro
    Kubuntu

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

    I'm not what KDevelop has to do with this?

    If you need the size of an std::string, use the size() (or length()) method.

    If you need to examine the size whilst debugging the application, you should be able to call that method as well. If you want to examine the contents of the data within the string as you are debugging, then printing the _M_dataplus._M_p attribute should suffice.

    Btw, you can also call the function data() to get the data stored within a string.
    Last edited by dwhitney67; November 6th, 2009 at 03:00 AM.

Bookmarks

Posting Permissions

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