How to write C code to implement the DOS command "DIR"

gates2010's Avatar, Join Date: Nov 2007
Newbie Member

I am trying to implement the DIR command for my client server proj. When the client sends a list command to the server the server should list all the files in the files directory which is located in the same place as the server program.

If you have an idea or u know any functions i could use pelase let me know

thank u
Salem's Avatar, Join Date: Nov 2007
Ambitious contributor
It depends which operating system the program will be running on.

For Unix/Linux, look at the opendir(), readdir() and closedir() functions.
For Win32, it's FindFirstFile(), FindNextFile() and FindClose() functions.