Run program in background.
Reid Thompson
Reid.Thompson@ateb.com
Tue Oct 5 13:44:00 GMT 2004
Brian Dessent wrote:
>
> If you just want your program to simply run in the
> background, launch it with a "&" at the end of the command
> from the shell. However, if it expects to use stdout, stdin,
> or stderr, it will stop -- so these must all be redirected to files
> or pipes.
not exactly correct the program does not stop, stdin is not accessible
via the shell, but stdout and stderr are by default, still routed to it.
$ cat back.c
#include <stdio.h>
int main (void)
{
int ctr = 0;
printf("From stdout\n");
fprintf(stderr, "From stderr\n");
for (ctr = 0; ctr < 5; ++ctr)
{
printf("%d\n", ctr);
sleep(2);
}
return(0);
}
WS-XP-4960:/home/rthompso>
$ ./a &
[2] 5076
WS-XP-4960:/home/rthompso>
$ From stdout
From stderr
0
1
2
3
4
[2]+ Done ./a
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
More information about the Cygwin
mailing list