Find the answer to your Linux question:
Results 1 to 4 of 4
i want to user system call on linux . include ">" and ">>" and "|" example command cat /etc/sysconfig/network | grep GATEWAY | cut -d= -f2 or arp -en | ...
  1. #1
    Just Joined!
    Join Date
    Jun 2007
    Posts
    84

    how to user system call in C Programing

    i want to user system call on linux . include ">" and ">>" and "|"

    example command

    cat /etc/sysconfig/network | grep GATEWAY | cut -d= -f2

    or

    arp -en | grep $1 | awk '{print $3}' > test.txt
    ** $1 user input same shell scripts such as 172.168.1.1

    or


    how to programing this command in c programing
    (not shell script)

  2. #2
    Linux Engineer wje_lf's Avatar
    Join Date
    Sep 2007
    Location
    Mariposa
    Posts
    1,192
    Code:
    man 3 system
    --
    Bill

    Old age and treachery will overcome youth and skill.

  3. #3
    Linux User
    Join Date
    Mar 2008
    Posts
    287
    Bill has it correct. Note bottom of that page.
    From my dim recollection, I recall having a problem with piping commands.
    If you do then examine "exec" as system(exec(urbashcommand)) I think that was what I had to do but it was several years ago.

  4. #4
    Linux Engineer wje_lf's Avatar
    Join Date
    Sep 2007
    Location
    Mariposa
    Posts
    1,192
    From my dim recollection, I recall having a problem with piping commands.
    The system() library call handles piping.
    --
    Bill

    Old age and treachery will overcome youth and skill.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...