Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
| 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.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
09-04-2010, 03:46 AM
|
#1
|
|
LQ Newbie
Registered: Sep 2010
Posts: 8
Rep:
|
Creating a shell using C which could Implement LS command
Dear Experts
I would like to create the shell which would support the LS command in C++.
And the way the command prompt can be changed.
Any help is highly appreciated
Regards
|
|
|
|
09-04-2010, 03:52 AM
|
#2
|
|
Senior Member
Registered: Dec 2008
Location: Gurgaon, India
Distribution: OpenSUSE 11.4
Posts: 4,582
|
|
|
|
|
09-04-2010, 06:45 AM
|
#3
|
|
LQ 5k Club
Registered: Sep 2009
Distribution: Arch x86_64
Posts: 6,443
|
Quote:
Originally Posted by imrrann
Dear Experts
I would like to create the shell which would support the LS command in C++.
And the way the command prompt can be changed.
Any help is highly appreciated
Regards
|
The ls command is an executable in the $PATH (usually /bin/ls), it's not built into the shell.
|
|
|
|
09-05-2010, 01:42 AM
|
#4
|
|
Member
Registered: May 2009
Distribution: slackware, fedora, ubuntu
Posts: 94
Rep:
|
There are built-in libraries in C++ that you can use to emulate a shell which supports basic commands like ls and it's other options.
|
|
|
1 members found this post helpful.
|
09-05-2010, 03:50 PM
|
#5
|
|
LQ Newbie
Registered: Sep 2010
Posts: 8
Original Poster
Rep:
|
Dear All
I have prohibited to use system or exec family of commands for implementing LS in my shell using C.
Any function which would return the names of files and sub-directories in the current working directory
THanks
|
|
|
|
09-05-2010, 04:27 PM
|
#6
|
|
Guru
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 12,008
|
Quote:
Originally Posted by imrrann
Dear All
I have prohibited to use system or exec family of commands for implementing LS in my shell using C.
Any function which would return the names of files and sub-directories in the current working directory
|
Ok. You've told us what you WANT, but not what you've DONE. What have you tried? And the fact that you say you can't use system or exec calls is telling...that almost shouts that this is homework.
Did you bother to try to look this up? Google for it? Do ANYTHING?
From a 10 second Google search:
http://snippets.dzone.com/posts/show/5734
|
|
|
|
09-06-2010, 01:02 AM
|
#7
|
|
Senior Member
Registered: Dec 2008
Location: Gurgaon, India
Distribution: OpenSUSE 11.4
Posts: 4,582
|
Quote:
Originally Posted by imrrann
I have prohibited to use system or exec family of commands for implementing LS in my shell using C.
|
When you post a question, do bother to post all the restrictions that are imposed w.r.t solving the question.
Check this post/thread:
http://www.linuxquestions.org/questi...6/#post1079538
|
|
|
|
09-07-2010, 01:26 AM
|
#8
|
|
Moderator
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,916
|
And since you've fired off yet another thread on the same
topic (in an admittedly better suited forum) I'll close this
one, and issue yet another warning for you.
http://www.linuxquestions.org/questi...d-in-c-830563/
Just making this clear - you're not making friends with
your behaviour on the boards.
Cheers,
Tink
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 07:54 PM.
|
|
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
|
|