494

C++ trim function

in

Trim function for C++ std::string:

using namespace std;
#include <string>
 
inline string trim(const string& o) {
  string ret = o;
  const char* chars = "\n\t\v\f\r ";
  ret.erase(ret.find_last_not_of(chars)+1);
  ret.erase(0, ret.find_first_not_of(chars));
  return ret;
}

It returns a new string, sort of like it’s done in Qt or Java.

Qt GDB errors

in

I’ve been having strange problems with Qt4 applications and GDB. I can’t debug any Qt4 app in either Eclipse or KDevelop. See this thread on the qt-interest list. The error I get:

Cannot insert breakpoint 0.
Error accessing memory address 0x0: Input/output error.

Running GDB from the command line on the binary works fine. I just found that NetBeans 6.0 with the C++ plugin works fine as well. I wonder what’s wrong with Eclipse and KDevelop. Could be the way they try to interface with GDB.

Syndicate content Syndicate content