I'm trying to make it so that when I press a key on the keyboard, onChar appends the value to a string that belongs to a list. It's causing some type of error though. Please help me figure this out, if you could.
If it's a cause of confusion, m_stringlist is a std::list<std::string *> and m_stringlistiter is a std::list<std::string *>::iterator.
Thank you
void Controller::onCreate(xMessage *msg)
{
std::string *first_string;
first_string = new std::string("Welcome to this program!\n");
m_stringlist.push_back(first_string);
first_string = new std::string("... ");
m_stringlist.push_back(first_string);
m_stringlistiter = m_stringlist.begin();
}
void Controller::onChar(xMessage *msg)
{
// Create a string object
std::string buf;
// Assign the string object the value of the char entered
buf = LOWORD(msg->wparam);
// Get the current line
std::string *curline = *m_stringlistiter;
// Append the char to the current line
std::string compline = *(curline) + buf;
// Print the compline
MessageBox(msg->hwnd, compline->c_str(), "Title", MB_OK);
}
std::list<std::string *> List of pointer to strings problem
Started by akumafan, Oct 01 2011 12:45 PM
No replies to this topic
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account

Back to top









