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
Ïà¹ØÎĵµ£º
#ifndef __KERNEL__
#define __KERNEL__
#endif
#ifndef MODULE
#define MODULE
#endif
#include<linux/config.h>
#include<linux/module.h>
#include<linux/version.h>
#include<linux/init.h>
#include<linux/kernel.h>
#include<linux/errno.h>
#include<linux/sche ......
Ò»:ǰÑÔ
I2cÊÇphilipsÌá³öµÄÍâÉè×ÜÏß.I2CÖ»ÓÐÁ½ÌõÏß,Ò»Ìõ´®ÐÐÊý¾ÝÏß:SDA,Ò»ÌõÊÇʱÖÓÏßSCL.ÕýÒòΪÕâÑù,Ëü·½±ãÁ˹¤³ÌÈËÔ±
µÄ²¼Ïß.ÁíÍâ,I2CÊÇÒ»ÖÖ¶àÖ÷»ú¿ØÖÆ×ÜÏß.ËüºÍUSB×ÜÏß²»Í¬,USBÊÇ»ùÓÚmaster-slave»úÖÆ,ÈκÎÉ豸µÄͨÐűØÐëÓÉÖ÷»ú·¢Æð²Å¿ÉÒÔ.¶ø
I2C ÊÇ»ùÓÚmulti master»úÖÆ.һͬ×ÜÏßÉÏ¿ÉÔÊÐí¶à¸ömaster.¹ØÓÚI2CÐÒéµÄÖª ......
TIOBEÊÀ½ç±à³ÌÓïÑÔÅÅÐаñÕ¹ÏÖÁ˱à³ÌÓïÑÔµÄÁ÷ÐÐÇ÷ÊÆ¡£Ã¿¸öÔ£¬¶¼ÓÐ×îеÄÊý¾Ý±»¸üС£Õâ·ÝÅÅÐаñµÄÊý¾ÝÈ¡ÑùÀ´Ô´ÓÚ»¥ÁªÍøÉϸ»ÓоÑéµÄ³ÌÐòÔ±¡¢ÉÌ ÒµÓ¦Óá¢ÖøÃûµÄËÑË÷ÒýÇæ£¨ÖîÈç¹È¸è¡¢ MSN ¡¢ÑÅ»¢£©µÄ¹Ø¼ü×ÖÅÅÃû¡¢ Alexa ÉϵÄÅÅÃûµÈ¡£Çë×¢ÒâÕâ¸öÅÅÐаñÖ»ÊÇ·´Ó³ÁËij¸ö±à³ÌÓïÑÔµÄÈÈÃÅ³Ì¶È , Õâ²¢²»´ú±íËüÊÇÒ»¸ö×îºÃµÄ±à³ÌÓïÑÔ» ......
VB
If MSComm1.PortOpen = True Then MSComm1.PortOpen = False
MSComm1.CommPort = i1
MSComm1.PortOpen = True
MSComm1.InputMode = comInputModeBinary
MSComm1.InBufferCount = 0
& ......
1.½éÉÜÒ»ÏÂSTL£¬Ïêϸ˵Ã÷STLÈçºÎʵÏÖvector¡£
Answer:
STL (±ê׼ģ°æ¿â£¬Standard Template Library)ËüÓÉÈÝÆ÷Ëã·¨µü´úÆ÷×é³É¡£
STLÓÐÒÔϵÄһЩÓŵ㣺
¿ÉÒÔ·½±ãÈÝÒ×µØÊµÏÖËÑË÷Êý¾Ý»ò¶ÔÊý¾ÝÅÅÐòµÈһϵÁеÄËã·¨£»
&nb ......