Hi,
in below code snippet i am trying to resume again forground process by issuing fg %1 in code but still it doesn't work.
usually after issuing fg %1 from command prompt it should alwaysstart first suspended process but same is not happening
and i am getting error like ; sh: line 0: fg: no job control.
#include<stdio.h>
#include<signal.h>
#include<unistd.h>
void sig_handler(int signo)
{
if (signo == SIGTSTP)
printf("received SIGINT \n");
system("fg %1");
printf("process will be resumed again");
}
int main(void)
{
if (signal(SIGTSTP, sig_handler) == SIG_ERR)
printf("\ncan't catch SIGSTP\n");
// A long long wait so that we can easily issue a signal to this process
for(;;){ }
//printf("resuming the process");
}