Thread: C++/SDL How To Find A Image In A Folder

  1. #1
    Registered User
    Join Date
    Feb 2013
    Location
    Sweden
    Posts
    171

    Question C++/SDL How To Find A Image In A Folder

    Hey there! My problem is that I don't know how to load a image with the load_image(""); function if it has a path like this: ..\\enemy\enemy.png

    But if it is in the same directory as the C++ file and project then it's just to enter it's name. But I do need how to do this.

    I can't have all the images messed up in one folder.

    I mean minecraft can put the images in diffrent folders it would have been a hell to find all of the images for them otherwise.

    Please help!

  2. #2
    Registered User MutantJohn's Avatar
    Join Date
    Feb 2013
    Posts
    2,665
    I think you need to write the full path. I think it'll follow any full path you write but default to the current directory.

  3. #3
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    Quote Originally Posted by DecoratorFawn82 View Post
    if it has a path like this: ..\\enemy\enemy.png
    You need to write it like this ..\\enemy\\enemy.png
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  4. #4
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    2,738
    SDL has no problems with relative paths, you can load "..\\enemy\\enemy.png" as easily as "enemy.png".
    Devoted my life to programming...

  5. #5
    Registered User
    Join Date
    Feb 2013
    Location
    Sweden
    Posts
    171
    Thanks for your replies tried all of the examples but none of them worked

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 04-27-2011, 04:34 AM
  2. trying to find and list all mp3's in folder.
    By erik in forum C++ Programming
    Replies: 3
    Last Post: 09-18-2005, 05:47 PM
  3. How to find the coords of an image map?
    By Geo-Fry in forum Tech Board
    Replies: 3
    Last Post: 09-08-2003, 05:54 PM
  4. Programmatically find path to temp folder.
    By Bajanine in forum Windows Programming
    Replies: 2
    Last Post: 04-23-2003, 09:25 PM