摘要:#include<stdlib.h>#include<stdio.h>#include<errno.h>#include<pthread.h>//externinterrnop;//externinterrno;extern_text;extern_etext;extern_data;extern_edata;//externchar*environ[];inti_initialized=1;/*initializedglobalvariable.*/longl_uninitialized;/*uninitializedglobalvariabl
阅读全文
摘要:voidprint(char(*arr)[10],intlen){inti;for(i=0;i<len;i++){printf("%s",arr[i]);}printf("\n");}intmain(){chararr[][10]={"bac","bca","abc","acb","cba","cab"};char*key="bca";char*ptr=NULL;printf("beforeqsort
阅读全文
摘要:intIBC_InfoIndb::read_file_from_dir(constchar*path,charfilename[][256],intmax_size,int*file_cnt){DIR*dir=NULL;structdirent*entry;cout<<"readdir:"<<path<<endl;dir=opendir(path);if(!dir){fprintf(stderr,"opendir%sfail!\n",path);return-1;}*file_cnt=0;readdir(dir);re
阅读全文
摘要:#include"apue.h"staticvolatilesig_atomic_tsigflag;/*setnonzerobysighandler*/staticsigset_tnewmask,oldmask,zeromask;staticvoidsig_usr(intsigno)/*onesignalhandlerforSIGUSR1andSIGUSR2*/{sigflag=1;}voidTELL_WAIT(void){if(signal(SIGUSR1,sig_usr)==SIG_ERR)err_sys("signal(SIGUSR1)error"
阅读全文
摘要:intbase_class::getWriteLock(string&filename){intfd=open(filename.c_str(),O_RDWR|O_CREAT,S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);if(fd<0){cerr<<"open"<<filename<<"fail!"<<endl;return-1;}structflockfl;fl.l_type=F_WRLCK;fl.l_start=0;fl.l_whence=SEEK_SET;fl.l_
阅读全文
摘要:#include<stdio.h>#include<stdlib.h>#include<stdarg.h>/***COPYRIGHTNOTICE*Copyright(c)2010,ffcs(版权声明)*Allrightsreserved.*@fileDebug.h*@brief按DEBUG_ZONE输出调试消息**当宏DEBUG被打开时,根据设置的DEBUG_ZONE输出相应的消息。DEBUG_ZONE可以通过*修改g_debug_setting的zone_mask修改。**@versionv1.0*@author*@date2010/11/09**修订说明
阅读全文
摘要:char*getCurrFileName(){FILE*stream;charfullname[1024];stream=popen("pwd","r");fread(fullname,sizeof(char),sizeof(fullname),stream);{inti;for(i=0;i<strlen(fullname);i++){if(fullname[i]=='\n'){fullname[i]=0;break;}}}sprintf(fullname,"%s/%s",fullname,__FILE__);p
阅读全文
摘要:#include<sys/sem.h>#include<stdio.h>#include<signal.h>#include<unistd.h>#include<stdarg.h>#include<string.h>sigset_toldset;typedefstruct__sig_mask{sigset_tsig_newset,sig_oldset;intset_flag;/*当调用完mask_procmask后,置1,否则,为0*/int(*mask_addsig)(struct__sig_mask*pSigMask,
阅读全文
摘要:#include"stdio.h"intdays[2][13]={365,31,28,31,30,31,30,31,31,30,31,30,31,366,31,29,31,30,31,30,31,31,30,31,30,31};intLeap(intyear)//判断是否为闰年{return((year%400==0)||(year%4==0&&year%100!=0));}intDeal(intdat0,intdat1){inti,temp,sum0,sum;intyear0,month0,day0,year1,month1,day1;sum0=sum=0
阅读全文
摘要:/*str_tok.h*/#ifndef_H_STR_TOK#define_H_STR_TOK#include<string.h>#include<stdio.h>#include"FPL_types.h"typedefstruct__NODE{char*pch;struct__NODE*next;}_NODE;typedefstruct__STRCK_TOK{int_MAXLEN;char*pStr;_NODE*phead;void(*setMaxLen)(struct__STRCK_TOK*,int);int(*getMaxLen)(struct
阅读全文
摘要:#include"stdafx.h"#include<stdarg.h>#include<stdio.h>#include<string.h>#include<stdlib.h>#ifndefDEBUG#defineDEBUG1#endif/*enumbool{false=0,true};typedefenumboolbool;*/boolmatch(char*name2,char*pre2);char*FPF_StrSpilit(constchar*str,char*token,constchar*delimit){char
阅读全文