How to read a dirctory?
Moving Shadow

Is it possible to find out what files exist in a directory in C/C++?

Evert

Of course!

Moving Shadow

Mind giving me an example!?

miran

Read the Allegro manual! The part about files. :)

LennyLen

findfirst/findnext

For example if you want to print the nhame of every file in a directory:

struct ffblk f;
int done = findfirst("*.*", &f, FA_HIDDEN | FA_SYSTEM);
while (!done)
{
  printf("%s\n", f.ff_name);
  done = findnext(&f);
}

[edit]

Quote:

Read the Allegro manual! The part about files.

al_findfirst
al_findnext
al_findclose

He did say C/C++, not C/C++ and Allegro. ;)

Moving Shadow

Excellent, excellent.....now.....how would I copy and paste a file, given the file name?

A J

copy filename destination

Thomas Fjellstrom

When not using allegro, I prefer:

CGamesPlay

And under windows, FindFirst/FindNext or something with those substrings.

Murat AYIK

I will print out this thread;D

Thread #571633. Printed from Allegro.cc