file type
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...
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 ]
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 ]
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
Get busy livin'' or get busy dyin''... - Shawshank Redemption
Assuming you want what comes after the last dot in the file name
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]
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]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement