#ifdef __WATCOMC__ #include #else #include #endif #include #include #include "jmalloc.hpp" #include void get_directory(char *path, char **&files, int &tfiles, char **&dirs, int &tdirs) { struct dirent *de; files=NULL; dirs=NULL; tfiles=0; tdirs=0; DIR *d=opendir(path); if (!d) return ; char **tlist=NULL; int t=0; char curdir[200]; getcwd(curdir,200); chdir(path); do { de=readdir(d); if (de) { t++; tlist=(char **)jrealloc(tlist,sizeof(char *)*t,"tmp file list"); tlist[t-1]=strcpy((char *)jmalloc(strlen(de->d_name)+1,"tmp file name"),de->d_name); } } while (de); closedir(d); for (int i=0;i