The regular shell allows a user to run a process in the background by ending the command with an &. I was asked to write a C program to do a similar job above. How can i write a background process ? Many Thanks !!

use fork() to create a child process and in the child process use execv() to call the background process.
read about fork() and execv() and their usage.

it looks like

int child;
child=fork();

if(child==0)
{
      execv(............);
}
else
{
        /*current process*/
}
commented: Good answer :) +36
commented: Excellent! +18
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.