Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
04-06-2007, 02:30 AM
|
#1
|
LQ Newbie
Registered: Apr 2007
Posts: 8
Rep:
|
getting strings for all the files and folders in a folder
Hi everyone:
I need to list all the files and folders that exists in a folder. Just like the LS function, however I need to do this is c++, without doing system calls.
What I actually need is to find a way to get into an array of strings, the name of each file and folder inside a certain folder.
Any idea how to do this?
Thank you
HW
|
|
|
04-06-2007, 02:39 AM
|
#2
|
LQ Newbie
Registered: Feb 2007
Posts: 29
Rep:
|
Do you mean without the system() call or without system calls? I suspect you mean the first one.
In that case, see "man readdir".
|
|
|
04-06-2007, 04:05 AM
|
#3
|
LQ Newbie
Registered: Apr 2007
Posts: 8
Original Poster
Rep:
|
I meant without doing any type system calls, my teacher wants me to implement the typical shell commands in c ++, without actually calling them, if I used them, then i would be cheating...
Anyway, thanks for your help, your suggestion works fine.
HW
|
|
|
04-06-2007, 05:57 AM
|
#4
|
LQ Newbie
Registered: Apr 2007
Location: China
Distribution: Unbuntu
Posts: 3
Rep:
|
I don't know exactly:
but I guess , you can do them using disk driver ;
if you write disk driver by yourself, then there is no systemcall,
.....
|
|
|
04-06-2007, 07:43 AM
|
#5
|
Senior Member
Registered: Mar 2005
Location: USA::Pennsylvania
Distribution: Slackware
Posts: 1,065
Rep:
|
`man ftw`
see if that is something like what you are looking for.
|
|
|
04-07-2007, 05:12 AM
|
#6
|
LQ Newbie
Registered: Apr 2007
Location: China
Distribution: Unbuntu
Posts: 3
Rep:
|
what is 'ftw'????
|
|
|
04-07-2007, 10:55 AM
|
#7
|
Senior Member
Registered: Mar 2005
Location: USA::Pennsylvania
Distribution: Slackware
Posts: 1,065
Rep:
|
Quote:
Originally Posted by goon83
what is 'ftw'????
|
refer to this post..
following the instructions there should provide an answer to your question..
|
|
|
All times are GMT -5. The time now is 04:25 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|