traverse a directory and list all file names?
-
Hello everyone, Are there any samples to traverse a directory and list all the file names? Written in C. thanks in advance, George
-
Hello everyone, Are there any samples to traverse a directory and list all the file names? Written in C. thanks in advance, George
George_George wrote:
list all the file names
You can use these API's: FindFirstFile() FindNextFile()
Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_
-
Hello everyone, Are there any samples to traverse a directory and list all the file names? Written in C. thanks in advance, George
See
WIN32_FIND_DATA find; HANDLE handle=FindFirstFile("*.*",&find); while(FindNextFile(handle,&find)!=0) m_List2.AddString(find.cFileName);//m_List2 is CListBox FindClose(handle);
_**
**_
WhiteSky
-
Hello everyone, Are there any samples to traverse a directory and list all the file names? Written in C. thanks in advance, George
-
George_George wrote:
list all the file names
You can use these API's: FindFirstFile() FindNextFile()
Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_
Thank you _AnShUmAn_! Are they C/C++ standard or Microsoft specific things? I want to use C/C++ standard API in my application. regards, George
-
See
WIN32_FIND_DATA find; HANDLE handle=FindFirstFile("*.*",&find); while(FindNextFile(handle,&find)!=0) m_List2.AddString(find.cFileName);//m_List2 is CListBox FindClose(handle);
_**
**_
WhiteSky
Hi WhiteSky, I find that there are some Microsoft specific things, like WIN32_FIND_DATA. Are there any API/structures which are standard C/C++? regards, George
-
Hi Ovidiu, The sample is very useful. Are there any non-Microsoft specific API/data structure samples? (I mean using pure C/C++ standard API/data structure.) regards, George
-
Hi Ovidiu, The sample is very useful. Are there any non-Microsoft specific API/data structure samples? (I mean using pure C/C++ standard API/data structure.) regards, George
George_George wrote:
Are there any non-Microsoft specific API/data structure samples? (I mean using pure C/C++ standard API/data structure.)
No file systems are platform specific.
I'd love to help, but unfortunatley I have prior commitments monitoring the length of my grass. :Andrew Bleakley:
-
George_George wrote:
Are there any non-Microsoft specific API/data structure samples? (I mean using pure C/C++ standard API/data structure.)
No file systems are platform specific.
I'd love to help, but unfortunatley I have prior commitments monitoring the length of my grass. :Andrew Bleakley:
Confused. All file system should be platform specific, on Window there are special file format, and on Linux, there are others. regards, George
-
Confused. All file system should be platform specific, on Window there are special file format, and on Linux, there are others. regards, George
George_George wrote:
All file system should be platform specific, on Window there are special file format, and on Linux, there are others
Yup, that's why there isn’t a single ANSI C++ method for accessing the files on the file system. Not to mention, *Nix and Windows treat directory structures differently. Simply '\' is the directory delimiter for Windows & '/" is the delimiter on *Nix (this is a high level difference, but everything adds up). If you want something that isn’t platform specific (as your posts indicated) your stuck with Java (I wonder how far along MONO is) or writing two separate classes and figure out which platform your on at compile time.
I'd love to help, but unfortunatley I have prior commitments monitoring the length of my grass. :Andrew Bleakley:
-
George_George wrote:
All file system should be platform specific, on Window there are special file format, and on Linux, there are others
Yup, that's why there isn’t a single ANSI C++ method for accessing the files on the file system. Not to mention, *Nix and Windows treat directory structures differently. Simply '\' is the directory delimiter for Windows & '/" is the delimiter on *Nix (this is a high level difference, but everything adds up). If you want something that isn’t platform specific (as your posts indicated) your stuck with Java (I wonder how far along MONO is) or writing two separate classes and figure out which platform your on at compile time.
I'd love to help, but unfortunatley I have prior commitments monitoring the length of my grass. :Andrew Bleakley:
Your reply makes senses, Douglas! regards, George
-
Your reply makes senses, Douglas! regards, George
-
George_George wrote:
Your reply makes sense
Glad I was able to help. :java: Why vote a 4? Not that it matters at all.
I'd love to help, but unfortunatley I have prior commitments monitoring the length of my grass. :Andrew Bleakley:
Hi Douglas, If you could provide sample code, I will rate it to 5. :-) regards, George