Link to home
Start Free TrialLog in
Avatar of balaganesh
balaganesh

asked on

How to call a process into the background in Unix on C++ program

How to call a process into the background  using system () function in C++ in Unix operating system?
Please give provide program or syntax  for it...
Avatar of sarda_ramesh
sarda_ramesh

hi
As we generally make a procee to run in background by adding an ampersand (&) to the command , the same way we can add an ampersand to the command as a parameter to system ..e.g

#include<stdio.h>

main()
{
   system("ls > output &");
}


this small code will run ls command in background and redirect the output to a file named output

hi
As we generally make a procee to run in background by adding an ampersand (&) to the command , the same way we can add an ampersand to the command as a parameter to system ..e.g

#include<stdio.h>

main()
{
   system("ls > output &");
}


this small code will run ls command in background and redirect the output to a file named output

ASKER CERTIFIED SOLUTION
Avatar of sarda_ramesh
sarda_ramesh

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Axter
balaganesh,
No comment has been added lately (196 days), so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area for this question:

RECOMMENDATION: Award points to sarda_ramesh http:#8064740

Please leave any comments here within 7 days.

-- Please DO NOT accept this comment as an answer ! --

Thanks,

Axter
EE Cleanup Volunteer