×Ô¼º¶¯ÊÖдһ¸öÅжÏÍøÖ·ºÏ·¨µÄC\C++µÄÕýÔò±í´ïʽ³ÌÐò
#include<stdio.h>
#include<regex.h>
int main(int argc, char** argv)
{
if(IsLegalPage("http://www.baidu.com"))
printf("¸ÃÍøÒ³ºÏ·¨\n");
else printf("¸ÃÍøÒ³²»ºÏ·¨£¡£¡£¡\n");
return 0;
}
/* º¯Êý˵Ã÷£ºÅжÏÍøÒ³ÊÇ·ñºÏ·¨
* ÊäÈë²ÎÊý£ºÐèÒªÅжϵÄÍøÖ·
* ·µ»Ø½á¹û£ºÍøÒ³ÊÇ·ñºÏ·¨(ºÏ·¨1£¬²»ºÏ·¨0)
*/
int IsLegalPage(char* s_tmp)
{
char* pattern="(https?)://.*(\.cn|\.com|\.htm|\.html|\.aspx?|\.jsp|\.php|/|/#)$";
printf("pattern=%s\n",pattern);
int z=0;
regex_t reg;
regmatch_t pm[1];
z=regcomp(®,pattern,REG_EXTENDED|REG_ICASE);
z=regexec(®,s_tmp,1,pm,0);
if(z!=0)
return 0;
else
return 1;
regfree(®);
}
Ïà¹ØÎĵµ£º
GCC ±àÒëc³ÌÐòµÄ·½·¨¼°¹ý³Ì½âÎö
Justin.zp.Yang 2010.04.10
Ä¿Ç° Linux ÏÂ×î³£ÓÃµÄ C ÓïÑÔ±àÒëÆ÷ÊÇ GCC £¨ GNU Compiler Collection £©£¬ËüÊÇ GNU ÏîÄ¿ÖзûºÏ ANSI C ±ê×¼µÄ±àÒëϵͳ£¬Äܹ»±àÒëÓà C ¡¢ C++ ºÍ Object C µÈÓïÑÔ±àдµÄ³ÌÐò¡£ GCC ²»½ö¹¦Äܷdz£Ç¿´ó£¬½á¹¹ ......
×¢ÒâÖ»Äܵ½2049Ä꣡
#define uchar unsigned char
#define uint unsigned int
#include <intrins.h>
/*
¹«ÀúÄê¶ÔÓ¦µÄÅ©ÀúÊý¾Ý,ÿÄêÈý×Ö½Ú,
¸ñʽµÚÒ»×Ö½ÚBIT7-4 λ±íʾÈòÔÂÔ·Ý,ֵΪ0 ΪÎÞÈòÔÂ,BIT3-0 ¶ÔӦũÀúµÚ1-4 ÔµĴóС
µÚ¶þ×Ö½ÚBIT7-0 ¶ÔӦũÀúµÚ5-12 Ô´óС,µÚÈý×Ö½ÚBIT7 ±íʾũÀúµÚ13 ¸öÔ´óÐ ......
Ò»¸öºÜ¼ò½àµÄËã·¨£º
void Reverse(char s[])
{
for(int i = 0, j = strlen(s) - 1; i < j; ++i, --j) {
char c = s[i];
s[i] = s[j];
s[j] = c;
& ......
ÔÚGmail TopLanguage Group Öп´µ½Ò»ÆªÎÄÕ“C/C++³ÌÐòÔ±±Ø¶ÁµÄÊ®±¾Ê飨ÉÏ£©”£¬´ó¼ÒµÄÌÖÂÛ¶¼ºÜ¼¤Àø£¬´ó¼Ò¶¼¾õµÃÕâƪÎÄÕÂдµÃºÜ°ô£¬ÎÒÏëÔÚGroupÀïµÄÅóÓѶ¼ÄÜÔÚLookgirlµÄÕâƪÎÄÕÂÀï»ñÒæ²»ÉÙ£¬Îª´Ë¶·µ¨ÔÚ´ËתÔظÃÎÄ£¬¹©¸ü¶àÅóÓѽ»Á÷¡¢Ñ§Ï°¡£
C/C++³ÌÐòÔ±±Ø¶ÁµÄÊ®±¾Ê飨ÉÏ£©
Õâ¸öÌâÄ¿´óµÄÓÐЩÀëÆ×£¬Êµ»°Ëµ£ ......
HTTP·ÖΪÇëÇóÐУ¬ÇëÇóÍ·²¿ÒÔ¼°ÇëÇóÄÚÈÝ
ÄǸö³¤¶ÈÊý×ÖÖµ¾ÍÊÇÇëÇóÄÚÈݵij¤¶È£¨×Ö½ÚΪµ¥Î»£©
¸øÒ»¶ÎÀý×ÓÄã¾Í»ù±¾Ã÷°×ÁË:
onst CString getString(int i)
{
CString s;
s.Format(_T("%d"), i);
return s;
}
////////////////////////////////
CS ......