Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Syrillix

file type

This topic is 5912 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

hi im trying to write a file loader for textures where i can send any texture type(filename) into the function. the problem is i dont know how to parse the file name and find out whether its a .tga or .bmp or what not.. anyone know of any resources, articles or stuff for this??? and before anyone burns me for not searching, i have searched google with no decent results and the search function on the forums is disabled...

Share this post


Link to post
Share on other sites
Advertisement
depends on what api you''re using as far as ''loading textures'' goes..
but if you want to know how to load every file known to man,
go to wotsit.org and check out the file specifications.


-eldee
;another space monkey;
[ Forced Evolution Studios ]


::evolve::

Share this post


Link to post
Share on other sites
not quite, i mean checking the file name that comes in to see if has a .tga or a .bmp extension

Get busy livin'' or get busy dyin''... - Shawshank Redemption

Share this post


Link to post
Share on other sites
Assuming you want what comes after the last dot in the file name


    
std::string filename, extension;
std::string::size_type backslash, dot;

backslash = filename.find_last_of( '\\' );
if ( backslash == std::string::npos )
backslash = 0;

dot = filename.find_last_of( '.', backslash );

if( dot != std::string::npos )
extension = filename.substr( dot );


extension will be empty if there are no dots in the name.

Documents [ GDNet | MSDN | STL | OpenGL | Formats | RTFM | Asking Smart Questions ]
C++ Stuff [ MinGW | Loki | SDL | Boost. | STLport | FLTK | ACCU Recommended Books ]


[edited by - Fruny on September 7, 2002 11:40:50 PM]

Share this post


Link to post
Share on other sites

  • 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!