PDA

View Full Version : Find Certain File Extensions



ImpactDNI
04-12-2003, 11:10 AM
This is more a C++ question, but ive had such good luck on these boards i figured i would post it here...
Im working on a program, and i need it to search through a folder and find all the files that end with a certain extension (.ase)... how do i get it to just go file by file and see if they end in .ase?

ImpactDNI
04-12-2003, 11:35 AM
another thing i just realized... i have a class called "model" to hold all the info about a model that is imported... the problem is, in the .ase file, there is a name for the model.. i also need to bring that name in, and then assign it as
model (whatever the name is);
how would i do this? this is how i have it, it tries to re-define "modelname"

char modelname[255];
when i try fscanf(*FILE*, "%s", &modelname);
model modelname;

any ideas?
thanks again!

yaro_dup1
04-12-2003, 12:05 PM
Those question has nothing with OpenGL!
But I'll help You.
To Find the file files *.ase You should do this:

#include <dir.h>

ffblk f;
done = findfirst("*.ase", &f, NULL);
while (!done)
{
// f.ff_name holds the file name
LoadModel(f.ff_name);
done = findnext(&f);
}

The second. I don't know ASE structure. You should check this for example in www.gametutorials.com (http://www.gametutorials.com)
To read the model name You have to know the adress of the chunk which keeps this and read this by function fread.

cheers,
yaro

Deiussum
04-14-2003, 04:34 AM
dir /s *.ase