execlp and File input

This is a discussion on execlp and File input within the C Programming forums, part of the General Programming Boards category; Hello, I'm trying to run a program via execlp and then fill it's input from another file. Ideally it is ...

  1. #1
    Registered User
    Join Date
    Apr 2003
    Posts
    23

    execlp and File input

    Hello,

    I'm trying to run a program via execlp and then fill it's input from another file.

    Ideally it is going to mimic file<input. I've been playing with fgets and fgetc but I can't figure out how to get the information into the file being executed. I think I would turn off the stdin for the file being executed and then send the information to it but I don't know how.

    Any suggestions....

    Thank you,

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,673
    Like I showed you here
    execlp output to file

    Only you open the file for reading and close(0)
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. execlp output to file
    By Schwarzhelm in forum C Programming
    Replies: 1
    Last Post: 11-04-2003, 12:24 AM
  2. Using execlp
    By mmondok in forum C Programming
    Replies: 0
    Last Post: 04-19-2003, 10:15 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21