how would i go about doing that? is there an api call or something?
thanks :)
Printable View
how would i go about doing that? is there an api call or something?
thanks :)
You just do a search for all files in a directory that are of type *.* (basically all files in the dir).Code:#include <stdio.h>
#include <dir.h>
int main(void)
{
struct ffblk ffblk;
int done;
printf("Directory listing of *.*\n");
done = findfirst("*.*",&ffblk,0);
while (!done)
{
printf(" %s\n", ffblk.ff_name);
done = findnext(&ffblk);
}
return 0;
}
also, you can use the system("dir"); command, like system("cls");
In WinAPI it would be FindFirstFile and FindNextFile.
ah cool
and instead of *.* and i specify a dir like C:\mydir?
To set the directory in API, use SetCurrentDirectory
so above the first *.* thing, use the "set current directory"?
thanks alot for your help
it says "cannot find dir.h"
is there a diff header file? i tried windows.h, no go
Borland always had more headers for handling DOS than VC++. Include <windows.h> and use the API functions.
i tried windows.h, still no workie.
...and use the API functions: FindFirstFile and FindNextFile (and SetCurrentDirectory)