Quote:
Originally Posted by laffytaffykidd
I basically have to write a program
|
That phrase implies a homework assignment.
You need to show a little more effort and/or ask more specific questions to expect homework assistance here.
Quote:
So far, I have only looked up man pages for opendir(), readdir(), stat()...
|
Are there specific details of those functions that you didn't understand from the man pages? That kind of question is OK to ask, even for homework.
Quote:
From there, I am still unsure about how I would write the ls command.
I'm a little new to the C language, but I am a little fluent in C++.
|
Does that mean you would know how to do it in C++ ?
You could start with a C++ program and then change each part of the program that does something not available in C to do the equivalent operation in a method supported by C. At each such step, you would still have a testable C++ program. At the end of all such steps you could have a program that works equally well in C++ or C.
Do you know how to use printf in C? printf is the same in C++, so you might even know how to use it there, but in C++ there are usually better alternatives to printf, so you might not.
Quote:
Originally Posted by laffytaffykidd
I'm not sure where to start.
|
If you know any programming at all then how is it possible you don't know where to start? Your program needs to get information and display information. You can't have needed me to tell you to start by dividing your effort into those two areas. You already took the biggest step (or maybe your instructor gave it to you) of selecting functions that are useful for the "get information" part of the task. And you already started by reading the man pages of those functions.