c signalµ÷ÓÃÎÊÌâ
¿ªÊ¼Ñ§OS,°´Á·Ï°ÒªÇóдµÄ´úÂëÔÚgccÏÂÎÞ·¨±àÒ룺
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
void SIGFPEhandler2(int sig1) {
printf("1");
signal(SIGFPE, SIGFPEhandler1);
exit(EXIT_SUCCESS);
}
void SIGFPEhandler1(int sig2) {
signal(SIGFPE, SIGFPEhandler2);
printf("2");
exit(EXIT_SUCCESS);
}
int DBZ(int i) {
return i/0;
}
int main(void) {
(void) signal(SIGFPE, SIGFPEhandler1);
DBZ(5);
return EXIT_SUCCESS;
}
Ä¿µÄÈÃsignal handlerµ÷ÓÃÁíÒ»¸ö handler£¬¶¼ÊÇ´¦ÀíͬÑùµÄsignal¡£±àÒëÌáʾSIGFPEhandler1 undeclare.
ÊÇÎÒʵÏֵķ½·¨²»¶Ô»¹ÊÇhandler²»Äܵ÷Óô¦ÀíͬÑùsignalµÄhandler? Íû´ó¼ÒÖ¸Õý¡£
ÔÚlinuxÏÂÂð£¿
windowsÏÂ, ÓõÄCygwin.
ÔÚSIGFPEhandler2 Ç° ÉùÃ÷ SIGFPEhandler1
º¯ÊýȱÉÙÇ°ÖÃÉùÃ÷
¼Ó
void SIGFPEhandler1(int sig2);
void SIGFPEhandler2(int sig1);
ÔÚÎļþÍ·ºó
±àÒë²»ÄÜͨ¹ý£¬ SIGFPEhandler2 undeclared.
Ïà¹ØÎÊ´ð£º
C/C++ code:
#include <stdio.h>
typedef struct node{
int *key;
int length;
}node;
void insert(node &temp,int n)
{
int i,j;
for(i=0;i<=temp.length;i++)
{
......
13¸öÈËΧ³ÉһȦ£¬´ÓµÚÒ»¸öÈË¿ªÊ¼Ë³Ðò±¨ºÅ1£¬2£¬3¡£·²±¨µ½3ÕßÍ˳öȦ×Ó£¬ÕÒ³ö×îºóÁôÔÚȦ×ÓÖеÄÈËÔÀ´µÄÐòºÅ
½á¹ûÓ¦¸ÃÊÇ13 ¿ÉÎҵijÌÐòµÄ½á¹ûÊÇ11 Ï£ÍûºÃÐÄÈË°ï¸ÄÒ»ÏÂ
#include <stdio.h>
#include < ......
GCCÊÇÃâ·ÑµÄÂð£¿ÄÇÓУ¿
LINUXϵͳÔõôװ£¿
ÖÐÎÄÔõôÉèÖã¿
Äã×°ÍêLinuxϵͳ¾Í»á×Ô´øGCC£¬windowsÏÂÒ²ÓÐGCC£¬±ÈÈçdev-c++,CODE::Blocks
linuxϵͳ°²×°¸ù¾Ý²»Í¬µÄlinux°æ±¾ÍøÉ϶¼Óн̳̣¬¿´ÏÂ¾Í ......
char data[255]={0},user[15],password[32];
if((fp=fopen("QQ.ini","wb+"))==NULL)
{
printf("ÎÞ·¨´´½¨QQ.iniÎļþ\n");
system("pause");
exit(0); ......
QQȺ 29152388
ÓÑÇéUP
°ï¶¥
up
°ïup
up Ö§³Ö£¡
up jf
...ÄѵÀÓзÖ..?
up up up
Ï£ÍûÓеüӷ֣¬¹þ¹þ¡£
Ö§³Ö£¬ÎÒ¼ÓÁË£¬Ï£ÍûÂ¥Ö÷ÄܼÓÎÒ£¬¹²Í¬Ñ§Ï°¹þ
¼ÓÁË¡£
¶¥ÉÏ£¬Ã¿ÌìÊÕ»ñÒ»µã£¬Ö§³Ö ......