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++ÈçºÎ±àдÇó½â3Dħ·½µÄ³ÌÐò£¬¸Ã´ÓºÎ¿ªÊ¼£¿
лл¸÷룬°ïæÌáµã½¨Òé°É¡£
http://www.mofang.net/code/176/182/6581.html
ÎÒÖ»ÄÜÍ»ÆÆ60Ã룡°¦¡£
ÎÒ¸Õ¹ý40Ãë
googleµÄandroidÖÐÓиöOpenGL ES + ......
±àÒëÆ÷£ºC-Free4
mysql µ¥¶À°²×°µÄ£¬ÏÖÔÚΪapache+php+mysql¿ÉÒÔʹÓá£
×î½üÔÚÁ·Ï°c£¬c++£»ÏëÓÃc£¬c++Á¬½ÓÏÂÎÒµÄmysql£¬ºÃ¶àµØ·½¶à˵mysql.hÕÒ²»µ½¡£¶øÇÒÎÒmysqlûÓÐËùνµÄincludeÎļþ¼Ð°¡¡£
Íü¸ßÊÖÖ¸µãÒ»¶ ......
дÁ˸ö²âÊÔ³ÌÐòÈçÏÂ
struct hostent *hp;
char AlarmDevIP[20];
int x2;
hp = gethostbyname("www.google.com");
if (hp)
{
......
ʹÓÃPHPµÄexecº¯Êýµ÷ÓÃlinuxµÄshellÃüÁÈçdateÈ¥ÐÞ¸Äʱ¼ä»òshutdownȥʵÏֹػú/ÖØÆô£¬µ«ÊÇ·µ»ØÖµ¶¼ÊÇʧ°ÜµÄ¡£¾¹ý¶à´ÎÊÔÑ飬È϶¨ÊÇûÓÐȨÏÞµÄÎÊÌâ¡£
ËùÒÔ£¬Ð¡µÜÔÚ´ËÇë½Ì¸÷룬ÈçºÎ²ÅÄÜÉèÖÃȨÏÞ£¬µ÷ÓÃlinux shellà ......
ÎÊÌâÒ»£º
ÔÚ¶ÔÆëΪ4µÄÇé¿öÏÂ
struct BBB
{
long num£»
char *name;
short int data;
char ha;
short ba[5];
}*p;
p=0x1000000;
p+0x200=____;
(Ulong)p+0x200=____;
(char*)p+0x200=____;
¼ÙÉèÔÚ32λC ......