C++ Ö®Boostѧϰ±Ê¼Ç Linuxϱà³Ì
C++ѧϰ±Ê¼Ç--Linuxϱà³Ì
Ò»¡¢¹ØÓÚBoostµÄʹÓ㬼¸ÖÖ³£Ó÷½·¨£¬Ö»ÊÇ×Ô¼º¹¤×÷¡¢Ñ§Ï°ÖÐ×ܽáµÄ£¬ÓÐЩ·½·¨µÄÈ·ÓÐЩ·±Ëö£¬ÄÜÂú×ãÐèÇó£¬Ó¦¸Ã»¹Óиü¼Ó¼òµ¥¿ì½ÝµÄ·½Ê½£¬´ý¸Ä½ø¡£
1¡¢ÅжÏ×Ö·û´®ÓëÕýÔò±í´ïʽÊÇ·ñÆ¥Å䣨ÍêÈ«Æ¥Å䣩
bool IsMatch(const char* data,const char * regx)
{
boost::regex expression(regx);
string str(data);
if(boost::regex_match(str, expression))
{
return true;
}
return false;
}
2.1¡¢°´Ä³Ò»×Ö·û´®½øÐзָî²Ù×÷£¬²¢´æ´¢µ½vectorÖС£
void split1(const char* data,boost::regex expression,vector<string> &dataVector)
{
string str1(data);//½«char *ת»¯ÎªstringÀàÐÍ
boost::sregex_token_iterator p(str1.begin( ), str1.end( ), expression, -1);
boost::sregex_token_iterator end;
const char *start=NULL,*endp;
while (p != end)
{
string str = *p;
printf("string:[%s]\n",str.c_str());
if ( str.compare("") != NULL )
{
dataVector.push_back(str);
}
p++;
}
}
2.2¡¢°´Ä³Ò»×Ö·û´®½øÐзָî²Ù×÷£¬²¢´æ´¢µ½vectorÖУ¬²¢±£Áô·Ö¸î·ûÖеļ¸Î»¡£
void split2(const char* data,boost::regex expression,vector<string> &dataVector,int length)
{
if ( length < 0 )
{
return ;
}
string str1(data);//½«char *ת»¯ÎªstringÀàÐÍ
boost::sregex_token_iterator p(str1.begin( ), str1.end( ), expression, -1);
boos
Ïà¹ØÎĵµ£º
Ò»¡¢Linux
²é¿´cpuÐÅÏ¢£º
[junjie2@ljj ~]$ cat /proc/cpuinfo
¶þ¡¢Freebsd
dmesg ×î¼òµ¥µÄ·½·¨
freebsd# cat /var/run/dmesg.boot |grep CPU ¿ÉÒԲ鿴 cpuÐÅÏ¢
sysctl hw.model ¿´cpuid
sysctl machdep.tsc_freq ¿´cpuƵÂÊ
# sysctl -a | egrep -i 'hw.machine|hw.model|hw.ncpu'
# dmesg | grep -i cpu ......
ÔÚlinuxÏÂһЩ³£ÓõĹػú/ÖØÆôÃüÁîÓÐshutdown¡¢halt¡¢reboot¡¢¼°init£¬ËüÃǶ¼
¿ÉÒÔ´ïµ½ÖØÆôϵͳµÄÄ¿µÄ£¬µ«Ã¿¸öÃüÁîµÄÄÚ²¿¹¤×÷¹ý³ÌÊDz»Í¬µÄ£¬Í¨¹ý±¾ÎĵĽéÉÜ£¬Ï£
ÍûÄã¿ÉÒÔ¸ü¼ÓÁé»îµÄÔËÓø÷ÖֹػúÃüÁî¡£
¡¡¡¡ 1.shutdown
shutdownÃüÁȫµØ½«ÏµÍ³¹Ø»ú¡£ ÓÐЩÓû§»áʹÓÃÖ±½Ó¶ÏµôµçÔ´µÄ·½ ......
<!--
@page { margin: 2cm }
P { margin-bottom: 0.21cm }
H1 { margin-bottom: 0.21cm }
H1.western { font-family: "DejaVu Serif", serif }
H1.cjk { font-family: "AR PL UKai CN"; font-size: 24pt; font-style: normal; font-weight: bold }
H1.ctl { font- ......
ÓÉÓÚÎÒÔÚÍøÉÏÏÂÔØÁËUbuntu LinuxÀ´°²×°·¢ÏÖÊÖͷû¿Õ°×¹âÅ̼̿cd,ËùÓÐgoogleÁËÏÂÕÒµ½ÁËÈçÏÂÎÄÕ½øÐÐʵ¼ù. ===================½Ì³Ì1========================== ˵µ½°²×°²Ù×÷ϵͳ£¬´ó¶àÊýÈËÊìϤµÄÊÇ´Ó¹âÅÌÒýµ¼£¬Æäʵ´ÓºÜ¶à´æ´¢É豸¶¼¿ÉÒÔʵÏÖϵͳÒýµ¼µÄ¡£ÓÉÓÚLinux²Ù×÷ϵͳµÄ·¢²¼ºÜ¶à£¬¶ø¶àÊýÈ˶¼ÊÇͨ¹ýÍøÂçÏÂÔزÙ×÷ϵͳµ ......