Jump to content
  • Advertisement

Archived

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

slashandburn

List Files In Directory?

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

I have a program Im making for school, using the "Marine biology" casestudy as a guide(reference, More like i have never looked at it and made my aquarium in 3d while everyone''s elses is a 2d matrix), and i just want mine to be 200% better then all the others in my class, How can i get(retrieve) all the file names in a folder. Like pass a function a directory(apstring) and it returns a vector(apvector) containing strings(APSTRINGS) of all the files in that directory.

Share this post


Link to post
Share on other sites
Advertisement
Use FindFirstFile, FindNextFile, and FindClose from Win32.

Alternatively, MSVCRT provides _findfirst, _findnext and _findclose.

Can I by any chance see what you've done to the case study files? I'm pretty amazed that someone decided to improve on AP classes. You're taking the AB test, right?

[edited by - IndirectX on April 17, 2002 12:01:54 AM]

Share this post


Link to post
Share on other sites
I mostly have rewritten the entire class structure to be easier for my extreme changes. Apvector and matrix and apstring were changed to include "windows.h" so they give errors in popups instead of couts, since im not using a console.

The Structure of it is like this(Sorta)
Notes*
The simulation class and neigbor class were combined with environment and plot. Instead of 1 fish perblock i allow for 10(Look for squares with 2 or 3 fish stacked on each other).
They can only eat, breed things in their same square.

Theyre are 3 images of what i have made so far at.

http://www.geocities.com/vbslashandburn/fish1.jpg
http://www.geocities.com/vbslashandburn/fish2.jpg
http://www.geocities.com/vbslashandburn/fish3.jpg

(Master Class) Holds all information.
(Environment Class)
Holds all fish and effects, also does all stepping. Move was removed from the fish.
Effects are like when toxic waste barrels fall down and destroy the fish. Or the cool air bubles.
(Fish Class) Holds information about fish
Food Amount
X Position
Y Position
Gender
Race (Silver or blue, etc skin)
Diet (Meat or algae)
Hungry (Am i hungry)
Pregnat(Am I)
Age (WorldTime) (How Old am I)
(Plot Class)
Number of fish im a block of land, Up to 10
(Static Object Class)
Holds information about "Reefs", "Crabs", "Starfish", "Seaweed"
X Y Z Position
(WorldTime Class)
Tells how old a object (Fish, Or world is)
Used for Night / Day Cycle

Share this post


Link to post
Share on other sites
I might, I think it would be over 800K with all the resource files (Textures, 3D Modles)

And how are those functions used to return file names?

Share this post


Link to post
Share on other sites
Untested:

  
WIN32_FIND_DATA wfd;
HANDLE hFind = FindFirstFile("*.dat", &wfd);
if (hFind)
{
do {
apstring filename = wfd.cFileName; // convert to apstring if you want, or use cFileName directly

// you can also use other members of wfd, like file size

} while (FindNextFile(hFind, &wfd));
FindClose(hFind);
}

Share this post


Link to post
Share on other sites
As a side note: since you''re redoing most of the AP stuff anyway, why not use STL? It seems much more efficient and certainly has more functionality.

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!