Thread: execlp and File input

  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 int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Like I showed you here
    http://cboard.cprogramming.com/showt...ghlight=dup%2A

    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.

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, 01:24 AM
  2. Using execlp
    By mmondok in forum C Programming
    Replies: 0
    Last Post: 04-19-2003, 10:15 PM