- 论坛徽章:
- 0
|
int glob_tmp = 6; /* external variable in initialized data */
char buf[] = "a write to stdout\n";
int
main(void)
{
int var; /* automatic variable on the stack */
pid_t pid;
var = 88;
if (write(STDOUT_FILENO, buf, sizeof(buf)-1) != sizeof(buf)-1)
err_sys("write error");
printf("before fork\n"); /* we don't flush stdout */
if ( (pid = fork())
printf("pid = %d, glob = %d, var = %d\n", getpid(), glob_tmp, var);
exit(0);
}
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u1/59712/showart_1994628.html |
|