Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Damacustas

Pages: [1]
1
System / Re: Runtime error sf::String
« on: February 24, 2013, 01:46:14 am »
nope, I'm sure I used the C++ libraries.
I used SFML 1.6 libraries pre-compiled by vs2008 with vs2010 and even recently I used those same libraries with vs2012. Only a week ago I decided to use SFML 2.0 and didn't have any issues except for the issue that started the thread.

2
System / Re: Runtime error sf::String
« on: February 23, 2013, 10:28:40 pm »
Thanks, that fixed the problem. I hadn't thought of recompiling since this isn't the first time I use libraries compiled by an older compiler, previously I encountered no issues.

Thanks again. :)

3
System / Runtime error sf::String
« on: February 23, 2013, 08:53:02 pm »
Hello,

I've written a class for reading textfiles. I'm currently using std::string but I wanted to switch to sf::String for better Unicode support, but as soon as I make any function use sf::String I get runtime errors.

For example, I have the following function, which executes just fine:
bool Open(const std::string& filename)
{
        if(this->IsOpen())
                this->Close();

        this->_stream.open(filename.c_str()); // _stream is of type std::ifstream.

        return this->_stream.good();
}

If I change it to this, things go wrong.
bool Open(const sf::String& filename)
{
        if(this->IsOpen())
                this->Close();

        this->_stream.open(filename.toAnsiString().c_str());

        return this->_stream.good();
}

After execution of this function, (when the temp std::string created by toAnsiString() gets destroyed) I get a "Application has triggered a breakpoint." with a callstack:
std::basic_string<char, std::char_traits<char> >::~std::basic_string<char, std::char_traits<char> >()
*std::basic_string internal calls*
std::allocator<char>::deallocate(char *_Ptr, unsigned int __formal)
operator delete (void* pUserData);
*more CRT internal calls*
_CrtIsValidHeapPointer(const void *pUserData)

Am I doing something wrong?

My setup:
- SFML 2.0 snapshot (linking against sfml-system-d.lib)
- Visual Studio Express 2012
- Windows 8 x64, compiling for x86

Thanks in advance for any help.

Pages: [1]