易截截图软件、单文件、免安装、纯绿色、仅160KB

Linux 下C问题

进程创建函数fork与vfork

C/C++ code:

#include<stdio.h>
#include<sys/types.h>
#include<unistd.h>
int globflag=9;
main()
{
pid_t pid;
int flag=0;
int i=0;

printf("vfork is diffirent with vfork\n");

// pid=fork();
pid=vfork();
if(pid==0)
{
i=3;
while(i-- >0)
{
printf("child process is running\n");
globflag++;
flag++;
sleep(1);
}
printf("child process:globflag=%d,flag=%d\n",globflag,flag);
}
else if(pid>0)
{
i=5;
while(i-- >0)
{
printf("parents process is running\n");
globflag++;
flag++;
sleep(1);
}
printf("parents process:globflag=%d,flag=%d\n",globflag,flag);
}
else
printf("process creat fail\n");
}



运行结果:
vfork is diffirent with vfork
child process is running
child process is running
child process is running
child process:globflag=12,flag=3
parents process is running
parents process is running
parents process is running
parents process is running
parents process is running
parents process:globflag=


相关问答:

能用C/C++简单实现五子棋程序吗?

最近突然想自己来实现一个五子棋程序,但不知道怎么开始,自己也没学画图形函数,能在控制台下直接写吗>>>?????
控制台?比图形界面更麻烦。
http://search.download.csdn.net/search/%E4%BA%94%E5%AD%90% ......

C/S程序在线自动更新问题,谢谢求教!

目前遇到的问题是:
存放在远程服务器端c/s程序一有更新,如何做到客户端立即响应弹出有最新升级的提示窗口。
本来有点思路:采用WCF+windowns服务+定时器的方式也能实现,但是每台客户端机子每隔都去访问一下远程 ......

有关linux安装脚本kickstart的编写

我之前制作的linux自动安装iso已经成功了,现在想对其进行一些定制修改,比如,更改grub图片等。
我在ks.cfg的%post段里面是这样写的:
%post --nochroot
# Move the contents of the tar into their new locati ......

问两道 C 面试题,高手帮看一下

1. 如下定义会有什么错误发生
  //file1.c
  int a[10];
  //file2.c
  extern int *a;
2. 大容量全局变量有什么危害,如
   
  //file.c
  ......

C 程序问题(四) - C/C++ / C语言

#include "stdio.h"
int main()
{
  char *ch(char *, char *);
  char str1[]="I am glad to meet you!";
  char str2[]="Welcom to study C!";
&nb ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号