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

This is a discussion on C++/SDL How To Find A Image In A Folder within the C++ Programming forums, part of the General Programming Boards category; Hey there! My problem is that I don't know how to load a image with the load_image(""); function if it ...

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

    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
    1,045
    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
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,484
    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
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

  4. #4
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    1,623
    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
    91
    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
  5. Find (width/height) attibute of image using _find operation
    By VanJay011379 in forum C++ Programming
    Replies: 1
    Last Post: 10-15-2002, 09:22 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21