Advertisement

unload class / char pointer

Started by February 16, 2018 11:24 AM
3 comments, last by Kylotan 6 years, 7 months ago

typedef struct FontInfo_t* FontHandle;
MichaelNS::FontMgr m;
MichaelNS::FontHandle FontGeladen;
const char *FontPtr;

start:

InFileFont.append("Ubuntu-B.ttf");
FontPtr = InFileFont.c_str();

FontGeladen = m.loadFont(FontPtr, NULL, NULL, 14, 0);

stop:

    m.unloadFont(FontGeladen);
    delete FontPtr;

delete causes a crash. How to unload the class correctly?

Thanks

If InFileFont is a std::string you shouldn't be trying to delete its contents. It will do that itself when it goes out of scope.

Advertisement

When I want to change char to string I get here:

 strcmp((*it).first.c_str(), inFontPath) == 0)

There is no suitable conversion function from "std :: string" to "const char *" ".

It's not clear why you are using c_str() and strcmp() - both of the objects appear to be std::string so you can just use == .

This topic is closed to new replies.

Advertisement