LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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


Reply
  Search this Thread
Old 04-06-2007, 02:30 AM   #1
Hard_Working_
LQ Newbie
 
Registered: Apr 2007
Posts: 8

Rep: Reputation: 0
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
 
Old 04-06-2007, 02:39 AM   #2
tread
LQ Newbie
 
Registered: Feb 2007
Posts: 29

Rep: Reputation: 15
Do you mean without the system() call or without system calls? I suspect you mean the first one.
In that case, see "man readdir".
 
Old 04-06-2007, 04:05 AM   #3
Hard_Working_
LQ Newbie
 
Registered: Apr 2007
Posts: 8

Original Poster
Rep: Reputation: 0
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
 
Old 04-06-2007, 05:57 AM   #4
goon83
LQ Newbie
 
Registered: Apr 2007
Location: China
Distribution: Unbuntu
Posts: 3

Rep: Reputation: 0
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,
.....
 
Old 04-06-2007, 07:43 AM   #5
xhi
Senior Member
 
Registered: Mar 2005
Location: USA::Pennsylvania
Distribution: Slackware
Posts: 1,065

Rep: Reputation: 45
`man ftw`

see if that is something like what you are looking for.
 
Old 04-07-2007, 05:12 AM   #6
goon83
LQ Newbie
 
Registered: Apr 2007
Location: China
Distribution: Unbuntu
Posts: 3

Rep: Reputation: 0
what is 'ftw'????
 
Old 04-07-2007, 10:55 AM   #7
xhi
Senior Member
 
Registered: Mar 2005
Location: USA::Pennsylvania
Distribution: Slackware
Posts: 1,065

Rep: Reputation: 45
Quote:
Originally Posted by goon83
what is 'ftw'????
refer to this post..

following the instructions there should provide an answer to your question..
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Samba can create new files and folders but access denied in any new folders k.king Linux - Networking 2 01-15-2006 06:14 AM
creating files/folders accessing root folder remotely NapalmBob Linux - Networking 2 09-24-2004 10:47 PM
Searching files for strings tmoorman Linux - Software 4 01-08-2004 01:46 PM
concatenating strings to open files veilig Programming 1 11-10-2003 05:36 PM
Folders not showing up! ::changing folder colors:: XxAndyxX Linux - Software 1 03-24-2003 04:04 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:25 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration