C/C++ std::string ÇдÊ
ÓÃÁËÈýÖÖ·½·¨...
#if 0
void StringTokenize(const std::string& strSrc, const std::string& strDelimit, std::vector<std::string>& vecSub)
{
if (strSrc.empty() || strDelimit.empty())
{
throw "tokenize: empty string\n";
}
vecSub.clear();
std::size_t nCurPos = 0;
std::size_t nNextPos = 0;
while ((nNextPos = strSrc.find_first_of(strDelimit, nCurPos)) != std::string::npos)
{
if (nNextPos - nCurPos > 0)
{
vecSub.push_back(strSrc.substr(nCurPos, nNextPos - nCurPos));
}
nCurPos = nNextPos + 1;
}
// Add the last one
std::string strLast = strSrc.substr(nCurPos);
if (!strLast.empty())
vecSub.push_back(strSrc.substr(nCurPos));
}
void StringToken(char *strToken, const char *strDelimit, std::vector<std::string>& vecSub)
{
assert(strToken && strDelimit && "Token, Delimit can not be NULL");
vecSub.clear();
char *pToken = strToken;
char *pNextToken = NULL;
pToken = strtok_s(pToken, strDelimit, &pNextToken);
while (pToken != NULL)
{
vecSub.push_back(pToken);
pToken = strtok_s(NULL, strDelimit, &pNextToken);
}
}
#endif
void StringTokenize(const std::string& strSrc, const std::string& strDelimit, std::vector<std::string>& vecSub)
{
if (strSrc.empty() || strDelimit.empty())
{
throw "tokenize: empty string\n";
}
vecSub.clear();
std::size_t nCurPos = 0;
std::size_t nNextPos = 0;
while ((nCurPos = strSrc.find_first_not_of(strDelimit, nNextPos)) != std::string::npos)
{
nNex
Ïà¹ØÎĵµ£º
--------Èç¹ûÄãÓõÄÊÇ»ò´òËãÓÃEclipse For C++£¬ÄÇô´ÓÕâÀï¿´,
1. Ê×ÏÈÏÂÔØEclipse for C++, ×îаæÊÇ»ùÓÚEclipse 3.5.2µÄ,eclipse-cpp-galileo-SR2-win32.zip
2. ½âѹ£¬Ö±½ÓÔËÐС£×¢Ò⣬ÖÁÉÙJDKÄãÒѾ°²×°ÁË£¨ÎÒÓõÄÊÇJDK1.6£©¡£ÔËÐкówelcomeÒ³Ãæ³öÏÖ£¬½øÈëTutorials¡£ÏȶÁTutorialÊǸöºÃÏ°¹ß¡£
3. Ê×ÏÈ Ê²Ã´ÊÇCDT... ......
ʲôʱºòÐèÒª´´½¨Ï̳߳ØÄØ£¿¼òµ¥µÄ˵£¬Èç¹ûÒ»¸öÓ¦ÓÃÐèҪƵ·±µÄ´´½¨ºÍÏú»ÙỊ̈߳¬¶øÈÎÎñÖ´ÐеÄʱ¼äÓַdz£¶Ì£¬ÕâÑùÏ̴߳´½¨ºÍÏú»ÙµÄ´øÀ´µÄ¿ªÏú¾Í²»ÈݺöÊÓ£¬ÕâʱҲÊÇÏ̳߳ظóö³¡µÄ»ú»áÁË¡£Èç¹ûÏ̴߳´½¨ºÍÏú»Ùʱ¼äÏà±ÈÈÎÎñÖ´ÐÐʱ¼ä¿ÉÒÔºöÂÔ²»¼Æ£¬ÔòûÓбØҪʹÓÃÏ̳߳ØÁË¡£
ÏÂÃæÊÇLinuxϵͳÏÂÓÃCÓïÑÔ´´½¨µÄÒ»¸öÏ̳߳ء£Ï̳߳ػ ......
C/C++º¯Êýµ÷ÓÃÔ¼¶¨ºÍº¯ÊýÃû³ÆÐÞÊιæÔò̽ÌÖ
×÷ÕߣºÐǹ죨oRbIt£©
ʹÓÃC/C++ÓïÑÔ¿ª·¢Èí¼þµÄ³ÌÐòÔ±¾³£Åöµ½ÕâÑùµÄÎÊÌ⣺ÓÐʱºòÊdzÌÐò±àÒëûÓÐÎÊÌ⣬µ«ÊÇÁ´½ÓµÄʱºò×ÜÊDZ¨¸æº¯Êý²»´æÔÚ£¨¾µäµÄLNK
2001´íÎ󣩣¬ÓÐʱºòÊdzÌÐò±àÒëºÍÁ´½Ó¶¼Ã»ÓдíÎ󣬵«ÊÇÖ»Òªµ÷ÓÿâÖеĺ¯Êý¾Í»á³öÏÖ¶ÑÕ»Òì³£¡£ÕâЩÏÖÏóͨ³£ÊdzöÏÖÔÚCºÍC ......
ÀûÓÃ
ÏÂÔصÄÕâ¶Î´úÂ룬³É¹¦ÊµÏÖÁËÊØ»¤½ø³Ì£¬ÔÀ´ÊØ»¤½ø³ÌÊǺܼòµ¥µÄÊÂÇé¡£
¡¡¡¡ÔÚmainº¯ÊýÖÐÖ´ÐÐ
¡¡¡¡init_daemon();//³õʼ»¯ÎªDaemon
¡¡¡¡¾Í¿ÉÒ԰ѽø³Ì±ä³ÉÊØ»¤½ø³Ì
¡¡¡¡
#include
#include
#include
#include
#include
void
init_daemon(void
)
{
int
pid;
int
i;
if
(pid=fork()) ......