need help on fork() and exec()

Good day

Can anybody assist me on my C project?I gotta write a C program to create a new process and within that new process execute a given function,and it focuses on the usage of system calls fork() and exec().

The user should be able to input and specify a pathname of a file to be executed and the required arguments or a string indicating the end of the run.The program should fork a child to execute the required program.

Really need the answer A.S.A.P...thanks a lot!



  • Please don't crosspost.
  • my dear freind,
    google/use richard steven's advanced programming in Unix environment.
    thats wgat i do normally, if cant find then reply i will give you the
    it divides the process in two or more parts after each its calling into: parent process and child process, where child process is pid==0

    If(int Childpid==0)
    exec(what the child has to do);
    ask parent to do what you want
    }also make sure you dont create a situation where parent is completed before please read the suggested link
    hope it will help, if not then please ask
  • thanks a lot for the reply!
    will try and solve the problem.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!