Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

C/C++ÖÐʹÓÃÕýÔò±í´ïʽ

Í·Îļþregex.hÖж¨ÒåÁËc/c++ʹÓÃÕýÔò±í´ïʽµÄº¯Êý£º regcomp(), regexec(), regerror(), and regfree() ¡£regcomp()±àÒëÕýÔò±í´ïʽ£¬regexec()Æ¥ÅäÕýÔò±í´ïʽ£¬ regfree()ÊÍ·ÅÕýÔò±í´ïʽ£¬regerror()±¨¸æÕýÔò±í´ïʽ´íÎóÐÅÏ¢¡£Ê¹Ó÷½·¨ÈçÏ´úÂëËùʾ£º
static string merge_path(const string base, const string path)
{
static regex_t re;


static int initialized = 0;
regmatch_t pm[1];
string p, s;
size_t len;
assert(*path != '/');
if (base && (p = strrchr(base, '/'))) {
newarray(s, (p - base) + strlen(path) + 2);
strncpy(s, base, (p - base) + 1);
strcpy(s + ((p - base) + 1), path);
} else {
newarray(s, strlen(path) + 2);
#if 0
s[0] = '/';
strcpy(s + 1, path);
#else
strcpy(s, path);
#endif
}
/* Replace all substrings of form "/xxx/../" with "/" */
if (! initialized) {
assert(regcomp(&re, "/[^/]+/\\.\\./", REG_EXTENDED) == 0);
initialized = 1;
}
len = strlen(s);


while (regexec(&re, s, 1, pm, 0) == 0) {
memmove(s + pm[0].rm_so, s + (pm[0].rm_eo - 1), len - pm[0].rm_eo + 2);
len -= pm[0].rm_eo - pm[0].rm_so - 1;
}
/* Replace all substrings of the form "/./" with "/" */
/*len = strlen(s);*/
for (p = s; (p = strstr(p, "/./")); ) {
memmove(p, p + 2, len - (p - s) - 1);
len -= 2;
}
return s;

¹ØÓÚC/C++ÖÐÕýÔò±í´ïʽµÄ¹æÔò£¬ÏÖ½«opengroup.orgµÄ½Ì³ÌÕª³­ÈçÏ£º£¨Ô­ÎÄÁ´½Óhttp://www.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html#tag_09_03_06£©
<<< Previous
Home
Next >>>
The Open Group Base Specifications Issue 7
IEEE Std 1003.1-2008
Copyright © 2001-2008 The IEEE and The Open Group
9. Regular Expressions
Regular Expressions (REs) provide a mechanism to select specific strings from a set of character strings.
Regular expressions are a context-independent syntax that can represent a wide variety of character sets and character set orderings, where these character sets


Ïà¹ØÎĵµ£º

PHPÀ©Õ¹C++


Õâ¸öÎĵµ¼òµ¥½éÉÜÁËÔõôʹÓÃC++ΪPHP±àдһ¸öÀ©Õ¹Ä£¿é¡£ÎÒÒѾ­±»Îʼ°Õâ¸öÎÊÌâÎÞÊý´ÎÁË£¬ËùÒÔÎÒ¾ö¶¨ÎªºóÀ´Õßдһ¸ö¼òµ¥µÄHOWTO¡£ÕâÆªÎÄÕÂÖ»»á˵Ã÷һЩҪµãºÍ¹Ø¼üÖ®´¦£¬Èç¹ûÄãÏ£ÍûѧϰC++»òPHP£¬Çë²éÔÄÆäËüµÄÎĵµ¡£
˳±ã£¬ÔÚ±¾ÎÄÖÐÎÒÃÇÒ²»á¿´Ò»ÏÂÔÚPHP5ÖÐÔõô°ÑC++ÀàÓ°Éäµ½PHPÖС£ÎÄÕÂÖеÄÀý×Ó¿ÉÒÔÔÚPHP4ºÍPHP5µÄ»·¾³ÏÂÊ¹Ó ......

2009Äê9ÔÂÓïÑÔÅÅÐаñ£ºPHP³¬Ô½C++


TIOBEÊÀ½ç±à³ÌÓïÑÔÅÅÐаñÕ¹ÏÖÁ˱à³ÌÓïÑÔµÄÁ÷ÐÐÇ÷ÊÆ¡£Ã¿¸öÔ£¬¶¼ÓÐ×îеÄÊý¾Ý±»¸üС£Õâ·ÝÅÅÐаñµÄÊý¾ÝÈ¡ÑùÀ´Ô´ÓÚ»¥ÁªÍøÉϸ»Óо­ÑéµÄ³ÌÐòÔ±¡¢ÉÌ ÒµÓ¦Óá¢ÖøÃûµÄËÑË÷ÒýÇæ£¨ÖîÈç¹È¸è¡¢ MSN ¡¢ÑÅ»¢£©µÄ¹Ø¼ü×ÖÅÅÃû¡¢ Alexa ÉϵÄÅÅÃûµÈ¡£Çë×¢ÒâÕâ¸öÅÅÐаñÖ»ÊÇ·´Ó³ÁËij¸ö±à³ÌÓïÑÔµÄÈÈÃÅ³Ì¶È , Õâ²¢²»´ú±íËüÊÇÒ»¸ö×îºÃµÄ±à³ÌÓïÑÔ» ......

C++ÖÐʹÓÃsqlite

#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include ".\sqlite3_lib\sqlite3.h"
 
static int _callback_exec(void * notused,int argc, char ** argv, char ** aszColName)
{
    int i;
    for ( i=0; i<argc; i++ )
   ......

Delphi Óë C/C++ Êý¾ÝÀàÐͶÔÕÕ±í

Delphi Óë C/C++ Êý¾ÝÀàÐͶÔÕÕ±í
DelphiÊý¾ÝÀàÐÍC/C++
ShorInt
8λÓзûºÅÕûÊý
char
Byte
8λÎÞ·ûºÅÕûÊý
BYTE,unsigned short
SmallInt
16λÓзûºÅÕûÊý
short
Word
16λÎÞ·ûºÅÕûÊý
unsigned short
Integer,LongInt
32λÓзûºÅÕûÊý
int,long
Cardinal,LongWord/DWORD
32λÎÞ·ûºÅÕûÊý
unsigned long
Int6 ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ