Finding the file path of all files in a folder

Viewed 3037

I'm trying to convert a bunch of images to textures using SDL. So far, I know its possible to do everything manually:

//Load front alpha texture
    if (!gModulatedTexture.loadFromFile("14_animated_sprites_and_vsync/text2.png"))
    {
        printf("Failed to load front texture!\n");
        success = false;
    }
    else
.....

However, I have quite a few images I want to load so what I'm looking for is a way to automate the process. I want to put all my images into a single folder, and then do something like this:

i=0
while (there are still images to load) {
     textureBank[i] = current image
     i++
}

I wast thinking there might be some easy way to just read in the file path of all the files in a directory, but I haven't been able to find a way to do that.

Any suggestions?

2 Answers
Related