I am trying to load a file using a string as a file name. This is the class that uses the string to load in the file.
In the fuction for the drawer class, I create a new Texture, and supply a string for the file to load in. (only related code posted). m_currentLevel is a Level class.Code:class Texture { int m_width; //width of the image int m_height; //height of the image unsigned char* m_pixels; //pixel data public: Texture(std::string fileName); ~Texture(); int getWidth(); int getHeight(); unsigned char* getPixels(); };
getFloorTexName() simply returns the string of the filename used for the floor texture.
Using this code, the program compiles just fine, but I get this error when I run it.Code:std::string texName = m_currentLevel->getFloorTexName(); Texture* texture = new Texture(texName); GLuint ID = loadTexture(texture);
Access violation reading location 0x00000018.
The compiler is pointing to this function in the <xstring> header file.
Am I not using the string class correctly? What is causing this error?Code:size_type size() const { // return length of sequence return (this->_Mysize); }



LinkBack URL
About LinkBacks


