linux tinyxml²åÈë½Úµã
bool InstertNode(string& szFileName)
{
TiXmlDocument myDocument(szFileName);
bool loadOkay = myDocument.LoadFile();
if(loadOkay == false)
return false;
//»ñµÃ¸ùÔªËØ
TiXmlElement *rootElement = myDocument.RootElement();
if(rootElement == NULL)
return false;
//´´½¨Ò»¸öPersonÔªËØ²¢Á¬½Ó¡£
TiXmlElement *PersonElement = new TiXmlElement("Person");
rootElement->LinkEndChild(PersonElement);
//ÉèÖÃPersonÔªËØµÄÊôÐÔ¡£
PersonElement->SetAttribute("ID", "3");
//´´½¨nameÔªËØ¡¢ageÔªËØ²¢Á¬½Ó¡£
TiXmlElement *NameElement = new TiXmlElement("name");
TiXmlElement *AgeElement = new TiXmlElement("age");
PersonElement->LinkEndChild(NameElement);
PersonElement->LinkEndChild(AgeElement);
//ÉèÖÃnameÔªËØºÍageÔªËØµÄÄÚÈݲ¢Á¬½Ó¡£
TiXmlText *NameContent = new TiXmlText("ÕÔÁÁÁÁ");
TiXmlText *AgeContent = new TiXmlText("30");
NameElement->LinkEndChild(NameContent);
AgeElement->LinkEndChild(AgeContent);
//±£´æ
myDocument.SaveFile(szFileName);
return true;
}
ÔÚÊ÷µÄĩβ²åÈëеĽڵã/ÔªËØ
Ïà¹ØÎĵµ£º
1. cdÃüÁî ¸Ä±äµ±Ç°Ä¿Â¼
cd netseek //½øÈënetseekÕâ¸öĿ¼¡£
cd //Í˳öµ±Ç°Ä¿Â¼¡£
2 .
pwdÃüÁî ²é¿´µ±Ç°ËùÔÚĿ¼ÍêÕû·¾¶
eg: pwd //²é¿´µ±Ç°ËùÔÚĿ¼·¾¶¡£
3. lsÃüÁî ²é¿´Ä¿Â¼»òÕßÎļþµÄÊôÐÔ£¬ÁоٳöÈÎһĿ¼ÏÂÃæµÄÎļþ
eg: ls /usr/man
4. rmÃüÁî
ɾ³ýÎļþºÍĿ¼
rm -rf Ŀ¼Ãû×Ö/ ......
³ÉΪһÃû¾«Í¨ Linux ³ÌÐòÉè¼ÆµÄ¸ß¼¶³ÌÐòÔ±Ò»Ö±ÊDz»ÉÙÅóÓÑ×Î×ÎÒÔÇóµÄÄ¿±ê¡£¸ù¾ÝÖлªÓ¢²ÅÍøÍ³¼ÆÊý¾Ý£¬±±¾©µØÇø Linux ³ÌÐòÔ±ÔÂнƽ¾ùΪ Windows ³ÌÐòÔ±µÄ 1.8 ±¶¡¢Java ³ÌÐòÔ±µÄ 2.6 ±¶£¬ Linux ³ÌÐòÔ±ÄêÖÕ½±½ðƽ¾ùΪ Windows ³ÌÐòÔ±µÄ 2.9 ±¶¡£Í¬Ê±Êý¾ÝÏÔʾ£¬Ëæ×ʤ×÷¾ÑéµÄÔö³¤£¬ Linux ³ÌÐòÔ±Óë Windows ³ÌÐòÔ±µÄÊÕÈë²î¾à» ......
ÎÊÌ⣺
gcc -c main.c -L ./include libmmgr.a
µÄʱºò£¬×ÜÊDZ¨´í£¬
ÕýÈ·µÄ×ö·¨ÊÇ
gcc -c main.c -L ./include -lmmgr
ÓÐÒ»¸öÎóÇøÊÇ£¬
gcc -c main.c -L. libmmgr.a
ÓÐʱºòÒ²ÊǶԵ쬵«ÕâÊÇÌØÀý£¬ÊÇmain.cºÍlibmmgr.aÔÚͬһ¸ö·¾¶Ï£¬ÕâʱµÄ-L.²»Æð×÷Ó㬼´Ê¹É¾³ýÒ²¿ÉÒÔ¡£ ......
[ת]Linux 2.6 ÄÚºËEpollÓ÷¨¾ÙÀý˵Ã÷
epollÓõ½µÄËùÓк¯Êý¶¼ÊÇÔÚÍ·Îļþsys/epoll.hÖÐÉùÃ÷µÄ£¬ÏÂÃæ¼òҪ˵Ã÷ËùÓõ½µÄÊý¾Ý½á¹¹ºÍº¯Êý£º
ËùÓõ½µÄÊý¾Ý½á¹¹:
typedef union epoll_data {
void *ptr;
int fd;
__uint32_t u32;
__uint64_t u64;
......
bool RemoveNode(string& szFileName)
{
TiXmlDocument myDocument(szFileName);
bool loadOkay = myDocument.LoadFile();
if(loadOkay == false)
return false;
//»ñµÃ¸ùÔªËØ
TiXmlElement *rootElemen ......