RE: [Dev-C++] list files in a directory
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: P.D. v. Z. <pa...@my...> - 2003-09-17 11:49:07
|
Hi, It depends on what OS you want it to work on. For Windows you can use the Win32 API functions FindFirstFile/FindNextFile/FindClose for example. I believe Boost also has a library for enumerating files and directories (www.boost.org) ... not sure though. I couldn't say anything about other platforms though, never had to enumerate files/directories on those (yet) :) Oh, and as for an example... this should do the trick on Win32 (off the top of my head, didn't check the specifics of the API calls, nor did I test the code): WIN32_FIND_DATA wfd; HANDLE hFind = FindFirstFile("*.*", &wfd); if (hFind == INVALID_HANDLE_VALUE) return; do { MessageBox(NULL, wfd.cFileName, "Found file or directory", MB_ICONINFORMATION); } while (FindNextFile(hFind, &wfd)); FindClose(hFind); Hope this helped :) Paul -----Original Message----- From: dev...@li... [mailto:dev...@li...] On Behalf Of Neszt Tibor Sent: Wednesday, September 17, 2003 11:50 AM To: dev...@li... Subject: [Dev-C++] list files in a directory Hello! Where can I find information about listing files? (C/C++ example) Regards, Neszt Tibor ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Dev-cpp-users mailing list Dev...@li... TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm https://lists.sourceforge.net/lists/listinfo/dev-cpp-users |