![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| how to get source code of Unix commands? | jagdish.machhi@ | Linux | 4 | 08-10-2007 10:44 AM |
| need help with some commands please | mujtba | UNIX for Dummies Questions & Answers | 2 | 01-14-2005 02:49 PM |
| commands | kironpmullamkuz | Security | 2 | 06-27-2002 11:45 PM |
| commands | Special K | UNIX for Dummies Questions & Answers | 3 | 02-13-2002 02:27 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
code that reads commands from the standard i/p and executes the commands
Hello all,
i've written a small piece of code that will read commands from standard input and executes the commands. Its working fine and is execting the commands well. Accepting arguments too. e.g #mkdir <name of the directory> The problem is that its not letting me change the directory i.e pwd is remaining the same. what changes should be made in it to let it change the directories too. Code:
#include <stdio.h>
#include <string.h>
#define MAXLINE 50
int main(void)
{
char buf[MAXLINE];
printf("%% ");
while (fgets(buf, MAXLINE, stdin) != NULL)
{
buf[strlen(buf) -1] = 0;
system(buf);
printf("%% ");
}
}
|
|
||||
|
Quote:
|
|
||||
|
okay...
thanks. |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|