PDA

View Full Version : Not really an openGL question...



newbie
11-17-2000, 03:53 PM
How do i get a list of files and directories? I'm using c++. (might be a lame http://www.opengl.org/discussion_boards/ubb/confused.gif question, never done anythin like that before, though)

11-17-2000, 07:41 PM
This is an old way using dos commands (just copied from turbo C++), you could use a common dialog box if you want to be able to browse the file structure and select a file. Oh and this won't show long filenames.

#include <stdio.h>
#include <conio.h>
#include <dir.h>

void main()
{
struct ffblk ffblk;
int done;

printf("Directory listing of *.*");
done = findfirst("*.*",&ffblk,0);
while (!done)
{
printf(" %s\n", ffblk.ff_name);
done = findnext(&ffblk);
}
getch();
}