On 3 Feb 2004 20:48:45 -0800,
sfrazq@hotmail.com (Excluded_Middle)
wrote in comp.lang.c:
[color=blue]
> Hi,
> My teacher gave me an assignment to create a shell using ANSI C and
> system calls. The shell is going to be very simple that can handle IO
> redirection and pipes.[/color]
Either you or your teacher is insufficiently knowledgable. It is
literally not possible to perform IO redirection or pipes in ANSI C.
On top of that, system calls are non-portable and not part of ANSI C
either. If your teacher literally told you to use those things in
ANSI C, your teacher does not know C and is unqualified to be teaching
the subject.
[color=blue]
> so far I create a program that prompts user and read commands using
> scanf and then save this command in a string called cmd. then it uses
> fork to create a child process and then execute the command using
> execlp,my teacher said use execvp but it was giving me error. i.e when
> I use[/color]
There are no such thing as "fork", "child process", or "execvp" in
ANSI C either. If your compiler supplies such things, they are
non-standard extensions it supplies, not part of C.
[color=blue]
> execvp(cmd,(char *)0) /* cmd is char cmd[200] */
> it gives me error.
>
> can any one explain why.[/color]
Nobody here will. We discuss the C language, not non-standard
extensions. You need to ask in a group that supports your particular
compiler/operating system combination.
--
Jack Klein
Home:
http://JK-Technology.Com
FAQs for
comp.lang.c
http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++
http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html