first, I'm using visual studio express 2012, with the sfml2.2.
I've trying to convert from sf::String to std::string. Basically I want user to input numbers, convert those numbers to int and then perform various calculations based on the input.
However every-time I run toAnsiString(), I get an error during the operator delete. The error is:-
When I press retry and I look into the stack, I see that the first entry in the stack is below.
Then the next stack entry up is below:
And then I see the operator delete in the next one.
My code is extremely basic as I've scaled it right back now to try to determine what I am doing wrong. I'm still very new to programming so help appreciated....with basic instructions.
I have double checked to ensure that sfml lib are linked correctly, i.e. I ensure I didn't mix up -d libs in the release configuration and vice-versa.
Here is my code. first my header
#ifndef TEST_H
#define TEST_H
#include <string>
#include <SFML/Graphics.hpp>
using namespace std;
class testClass
{
public:
testClass();
void testSFString();
bool chkStr();
private:
sf::String SFStr;
std::string stdStr;
};
#endif
Then my source file.
#include "test.h"
testClass::testClass()
{
}
void testClass::testSFString()
{
SFStr = "testStr";
if (chkStr())
{
stdStr = SFStr.toAnsiString(); //dies here
}
}
bool testClass::chkStr()
{
if (!SFStr.isEmpty())
return true;
else
return false;
}
finally my main
#include "test.h"
int main()
{
testClass test;
test.testSFString();
}