Jump to content
  • Advertisement
Sign in to follow this  
Mike555

Problem with file path

This topic is 1429 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

So i'm trying to load multiple files from a directory with for loop but i keep getting access violation and very strange path string.

Here is what i get in my path variable:

data/ÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌ0ùB

and here is the code used to make that variable:

Animation::Animation(std::string name, int framecount)
{
    char path[MAX_PATH];
    char *ext = ".bmp";
    frames = new SDL_Surface*[framecount];
    for (int k = 0; k < framecount; k++) {
        frames[k] = NULL;

        sprintf(path, "data/%s/f%i%s", name, k, ext);
        SDL_Surface *img = load_image(path);
        memset(&path[0], 0, sizeof(path)); // Clear tmp
    }

    maxFrames = framecount;
    currentFrame = 0;
}

I'm sure i'm doing something wrong with the char array but i just cant see it.

Edited by Mike555

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!