CString directoryPath = "C:\\MyDirectory"; CFileFind fileFinder; CFileItemList itemList; // Find all files and directories in the given directory BOOL found = fileFinder.FindFile(directoryPath + "\\*.*"); while(found) { found = fileFinder.FindNextFile(); // Add the current file/directory to the item list itemList.Add(fileFinder.GetFilePath()); }
wxDir dir("C:\\MyDirectory"); wxString filename; // Get all files and directories in the given directory if (dir.IsOpened()) { while (dir.GetFirst(&filename)) { // Add the current file/directory to the list itemList.Add(filename); } }In this example, we create a directory object using `wxDir` and open it by passing the directory path as a parameter. We then use the `GetFirst` method to retrieve the first file/directory in the directory. For each file/directory found, we add its name (represented as a `wxString`) to the `CFileItemList` using the `Add` method. In summary, `CFileItemList Get` is a method used to retrieve a list of files and directories in a file system. It is present in various C++ libraries such as MFC and wxWidgets.