Easy directory listing
This is an EASY example of listing files in a directory. I got this example from another post, but i could not get that post to work, so i modified it and made it easy to use. I'm using this in a new program i am working on.
AI
สรุปโดย AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
ซอร์สโค้ด
#include <iostream.h>
#include <windows.h>
int GetDir(char* dPath) {
WIN32_FIND_DATA FileData;
HANDLE hFile;
hFile = FindFirstFile(dPath,&FileData);
if ( INVALID_HANDLE_VALUE == hFile ) {
cout << "No files" << endl;
return false;
}
for ( ;; ) {
cout << FileData.cFileName << endl;
if ( 0 == FindNextFile(hFile, &FileData ) )
break;
}
return true;
}
int main() {
GetDir("c:\\*.txt");
return true;
}
ความคิดเห็นดั้งเดิม (3)
กู้คืนจาก Wayback Machine