hey, i'm exploring the Accessing a directory and all the files within it example in the faq for win32, and i've found a way to output the filenames to a file.problem is, if theres multiple dir's, it creates the file in each dir and outputs the content to that file. what i want it to do, is output all of the files to the txt file in the root dir. similar to the dos command: dir /s /b > output.txtCode:// print out in sorted order int numdirs = 0; for (i = 0; i < list.num_entries; i++) { char t1[50], t2[50], t3[50], a[10]; format_time(&list.files[i].ftCreationTime, t1); format_time(&list.files[i].ftLastAccessTime, t2); format_time(&list.files[i].ftLastWriteTime, t3); format_attr(list.files[i].dwFileAttributes, a); if (list.files[i].dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { // 'null' date for directory access times, which change each time // we run this tool sprintf(t2, "%4d/%02d/%02d %02d:%02d:%02d", 2000, 1, 1, 0, 0, 0); } fprintf(fileptr, "%s\n", list.files[i].cFileName); printf("%s %10ld %s %s %s %s\\%s\n", a, list.files[i].nFileSizeLow, t1, t2, t3, root, list.files[i].cFileName); if (list.files[i].dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) numdirs++; }
any help is welcome :] thx



LinkBack URL
About LinkBacks



