Help with system calls



I am writing a program which
a) accepts a command as a string
b) breaks the string into separate arguements
Eg: string : ls -l
argv[0]=ls arg[1]=-l
When I read the string using gets, it works fine. But when I use the
read(), it doesn't work.
I know how to parse the string and break them into individual
arguement, I am not happy with what I have coded it. Is there a
solution for this on the internet?
c) I need to exit when it presses ctrl-D. I don't know how to catch
ctrl-D. I tried a few things like, checking the first character of
the string with ascii value of ctrl-D, it's not working.
d) Also does anyone know how to empty the arrays?
PLEASE HELP..

.



Relevant Pages

  • Re: Help with system calls
    ... accepts a command as a string b) breaks the string into separate arguements ... the string with ascii value of ctrl-D, ...
    (comp.lang.c)
  • Help with system calls
    ... accepts a command as a string ... breaks the string into separate arguements ... I need to exit when it presses ctrl-D. ...
    (comp.lang.c)
  • TIP #185: Null Handling
    ... nulls, and command modifications for manipulating them. ... Tcl deals with strings, the universal medium for representing data. ... is know and it is an empty string, but if a respondent forgets to give ...
    (comp.lang.tcl)
  • Re: Determine how Word was launched
    ... inspect the command line used to launch Word. ... Private Declare Function GetCommandLineA Lib "kernel32" As Long ... Public Function GetCommandLineAs String ... Dim lngCmdLinePtr As Long ...
    (microsoft.public.office.developer.vba)
  • Re: Class.getMethod in classs static initializer block
    ... I just wanted to add that I had some similar code for a "command line server" project. ... static private final boolean DEBUG = true; ... {public ReturnCode runCommand(String s) ... public ReturnCode parseLine(String line) ...
    (comp.lang.java.programmer)