C++ÖеÄÊý¾ÝÀàÐÍת»»·½·¨×ܽá
ÕªÒª£º±¾ÎÄ×ܽáÁËC/C++ÖеĶàÖÖÊý¾ÝÀàÐÍת»»·½·¨£¬²¢±È½ÏÁ˸÷×ÔµÄÓÅÁÓ¡£¸ø³öÁËÍƼöµÄʹÓý¨Òé¡£
´Óintµ½char*£¬»òÕß·´¹ýÀ´´Óchar*µ½int£¬ÔÚC/C++Öе½µ×ÓжàÉÙÖÖת»»·½·¨ÄØ£¿·ûºÏ±ê×¼µÄ´ó¸ÅÓÐËÄÖÖ¡£¼´CÊý¾Ýת»»º¯Êý×å¡¢sprintf/snprintf/sscanfº¯Êý×å¡¢×Ö·û´®Á÷std::stringstream¡¢std::strsteam¡£²»·ûºÏ±ê׼ȴÓÖ¹ãΪʹÓõİüÀ¨CStringºÍboost::lexical_cast¡£±¾ÎÄÖ»ÌÖÂÛ·ûºÏ±ê×¼µÄת»»·½·¨£¬ÆäÖÐstd::strstreamÓÉÓÚÒѾ±»C++±ê׼ίԱΪָ¶¨Îª²»ÍƼöʹÓõģ¨deprecated£©£¬ËùÒÔ²»Ó迼ÂÇÁË¡£ÏÂÃæÖصãÌÖÂÛÈýÖÖ±ê׼ת»»·½·¨Ö®¼äµÄÓÅÁÓ¡£Ô´´úÂëµÄµØÖ·ÊÇ£ºhttp://download.csdn.net/source/631475
1. IntºÍchar*»òstd::stringÖ®¼äµÄת»»
CÊý¾Ýת»»º¯Êý×å
CÊý¾Ýת»»º¯Êý×å¼´°üÀ¨itoa¡¢atoiµÈÊý¾ÝÀàÐÍת»»º¯ÊýÔÚÄÚµÄÒ»´óÅúCº¯Êý£¬ÔÚCÓïÑÔʱ´úÔø¾±»´óÁ¿Ê¹Óá£Ô´´úÂëÈçÏ£º
int i = 10;
char szBuf[10] = "";
itoa(i, szBuf, 10);
cout<<"itoa: szBuf = "<<szBuf<<endl;
i = 0;
i = atoi(szBuf);
cout<<"atoi: i = "<<i<&l ......
1¡¢Í£Ö¹MYSQL·þÎñÆ÷£º
/etc/init.d/mysql stop»òservice mysqld stop
2. cd /etc/init.d/
£¨3£©Ìø¹ýÊÚȨ±íÖ´ÐÐMYSQL·þÎñÆ÷£º
mysqld_safe --skip-grant-tables --skip-networking &
(×¢£º²ÎÊý--skip-grant-tablesΪÌø¹ýÊÚȨ±í£»--skip-networkingΪ²»¼àÌýTCP/IPÁ¬½Ó)
[root@speedec init.d]# mysqld_safe --skip-grant-tables --skip-networking &
[1] 28135
[root@speedec init.d]# Starting mysqld daemon with databases from /var/lib/mysql
ÔÚ´Ë¿ÉÒÔCtrl+CÖÕÖ¹
(4).Æô¶¯mysql
[root@speedec init.d]# mysql
(5)ʹÓÃmysqlÊý¾Ý¿â
mysql> use mysql;
£¨6£©¸üÐÂrootÃÜÂë
update user set password=password('ÐÂÃÜÂë') where user='root';
7.ÖØÆômysql
service mysqld stop
service mysqld st ......
ºÄ·ÑÁËÒ»ÏÂÎ磬Ñо¿ÁËÒ»ÏÂVCµÄÊý¾Ý¿â±à³Ì£¬Ð´ÁËÕâ¸ö²âÊÔ³ÌÐò¡£Ö÷ÒªµÄ¹¦ÄÜΪʵÏÖaccessÊý¾Ý¿âµÄÌí¼ÓÓëɾ³ý£¬Í¬Ê±¶¯Ì¬µÄ½«Êý¾Ý¿âÊý¾ÝÏÔʾÔÚflexgrid¿Ø¼þÖС£ÏÂÃæ°Ñ¹ý³Ì¼Ç¼ÏÂÀ´£¬ÒÔ±¸ºóÓá£
Ò»¡£ADO¼ò½é
ADOÌṩÁËÒ»×é·Ç³£¼òµ¥£¬½«Ò»°ãͨÓõÄÊý¾Ý·ÃÎÊϸ½Ú½øÐзâ×°µÄ¶ÔÏó¡£ÓÉÓÚODBCÊý¾ÝÔ´Ò²ÌṩÁËÒ»°ãµÄOLE DB Privider£¬ËùÒÔADO²»½ö¿ÉÒÔÓ¦ÓÃ×ÔÉíµÄOLE DB Privider£¬¶øÇÒ»¹¿ÉÒÔÓ¦ÓÃËùÓеÄODBCÇý¶¯³ÌÐò¡£¹ØÓÚOLE DBºÍADOµÄÆäËüÏêϸÇé¿ö£¬¶ÁÕß¿ÉÒÔ×ÔÐвéÔÄÏà¹ØÊé¼®»òMSDN£¬ÕâÀï¾Í²»Ò»Ò»ËµÃ÷ÁË¡£ÈÃÎÒÃÇÖ±½Ó²½ÈëÖ÷Ì⣬ÈçºÎÕÆÎÕADOÕâÖÖÊý¾Ý¿â·ÃÎʼ¼ÊõADOµÄ²Ù×÷·½·¨ºÍÇ°Ãæ½²¹ýµÄDAOµÄ²Ù×÷Ôںܶ෽Ãæ´æÔÚÏàËÆÖ®´¦¡£
¶þ¡£Ö÷Òª¿Ø¼þµÄ²¼ÖÃ
³ÌÐòÔËÐÐЧ¹ûÈçͼ£º
1.½øÈ빤³ÌÏòµ¼£¬½¨Á¢»ùÓÚ¶Ô»°¿òµÄmfcÓ¦ÓóÌÐò¡£ÃûΪdatabasetest¡£
¼ÓÈëflexgrid¿Ø¼þ£º¹¤³Ì--->Ìí¼Óµ½¹¤³Ì------->components and controls¡£ÕÒµ½Microsoft Flexgrid control£¬È»ºóinsert¡£Ìí¼Ó¼¸¸östatic box ºÍeditbox£¬Ìí¼ÓÁ½¸öbotton£¬ÊµÏÖ²åÈëºÍɾ³ýµÄ¹¦ÄÜ¡£
2.´ò¿ªaccess2003£¬½¨Á¢¿ÕÊý¾Ý¿âDemo.mdb¡£½¨Á¢±íTable1¡£ÉèÖñàºÅ£¬Ê±¼ä£¬²ÉÑùµãÊý£¬ÀÛ¼Ó´ÎÊý£¬Êý¾Ý5¸ö×ֶΣ¬·Ö±ðΪ×Ô¶¯±àºÅ£¬Ê±¼ä/ÈÕÆÚ£¬Êý×Ö£ ......
ÔÚµ±½ñµÄÍøÂçʱ´ú£¬ÎÒÃdz£³£¼ûµ½µÄ½ø³Ì¼äͨÐÅ·½Ê½¶¼ÊÇsocket£¬±ÈÈçJavaµÄEJBµ÷Óã¬JavaºÍCͨÐÅ£¬Web Service·þÎñµÈ¡£socketÊÇ×î³£ÓõÄͨѶ¼¼Êõ£¬¼¸ºõËùÓеÄϵͳ¡¢ÓïÑÔ¶¼Ö§³Ö£¬socketÒ²ÊÇÃæÏòÍøÂçµÄ£¬Í¨ÐŵÄÁ½·½¿ÉÒÔ¿çÔ½IPÍøÂç½øÐд«Êä¡£
ÔÚ±¾µØͨÐÅÖÐ(ͬһ̨»úÆ÷ÉϵĽø³Ì¼äͨѶ)£¬socketµÄÍøÂçÌØÐÔÈ´³ÉÁËÀÛ׸£¬×é×°½âÎöÍøÂ籨ͷ¡¢±¨ÎÄÈ·ÈÏ¡¢CRCУÑéµÈ¶¼ÊÇÕë¶ÔÍøÂçµÄ£¬±¾µØͨÐÅûÓбØÒª£¬·´¶ø»áÓ°Ïì´«ÊäЧÂÊ¡£±¾µØͨÐŵÄһЩ´«Í³¼¼Êõ£¬Èç¹ÜµÀ¡¢FIFO¡¢ÏûÏ¢¶ÓÁеȣ¬Ã»ÓÐÍøÂ繦Äܵĸºµ££¬´«ÊäËÙ¶ÈÓ¦¸Ã¸ßÓÚsocket£¬Äǵ½µ×¸ß¶àÉÙÒÔÖÁÓÚÖµµÃÔÚÓ¦ÓÃÖÐÌæ»»socket¼¼ÊõÄØ£¬½ñÌì¾ÍÀ´Ò»³¡Ð¡²âÊÔ£¬¾ÍSystem VÏûÏ¢¶ÓÁкÍsocketÖ®¼ä£¬×öÒ»´ÎÈ«ÃæµÄËٶȱÈÆ´¡£
±ÈÆ´³¡µØ£º
±¾È˵ıʼDZ¾£ºÈüÑï1.5G ÄÚ´æ1.5G
ϵͳ£ºUbuntu8.04 Desktop (Linux 2.6.24-24-generic)
JDK£º1.6
µÚÒ»»ØºÏ£º Java²âÊÔ
ÏÈ˵Ã÷һϣ¬Java²¢²»Ö§³ÖSystem VÏûÏ¢¶ÓÁУ¬Òò´ËÌØΪJavaÌṩÁËJNI½Ó¿Ú£¬ÎÒÃÇʹÓÃlajp_9.09ÌṩCÔ´Âë±àÒëµÄso¶¯Ì¬Á¬½Ó¿â£¬lajpµÄÏÂÔصØÖ·ºÍÎĵµ£ºhttp://code.google.com/p/lajp/
Ê×ÏÈÉϳ¡µÄÊÇSystem VÏûÏ¢¶ÓÁС£
·¢ËͶ˳ÌÐò:
001 package test;
002
003 &nb ......
C/C++·µ»ØÄÚ²¿¾²Ì¬³ÉÔ±µÄÏÝÚå
³Âð©
±³¾°
ÔÚÎÒÃÇÓÃ
C/C++¿ª·¢µÄ¹ý³ÌÖУ¬×ÜÊÇÓÐÒ»¸öÎÊÌâ»á¸øÎÒÃÇ´øÀ´¿àÄÕ¡£Õâ¸öÎÊÌâ¾ÍÊǺ¯ÊýÄںͺ¯ÊýÍâ´úÂëÐèҪͨ¹ýÒ»¿éÄÚ´æÀ´½»»¥£¨±ÈÈ磬º¯Êý·µ»Ø×Ö·û´®£©£¬Õâ¸öÎÊÌâÀ§
Èźͺܶ࿪·¢ÈËÔ±¡£Èç¹ûÄãµÄÄÚ´æÊÇÔÚº¯ÊýÄÚÕ»ÉÏ·ÖÅäµÄ£¬ÄÇôÕâ¸öÄÚ´æ»áËæן¯ÊýµÄ·µ»Ø¶ø±»µ¯Õ»ÊÍ·Å£¬ËùÒÔ£¬ÄãÒ»¶¨Òª·µ»ØÒ»¿éº¯ÊýÍⲿ»¹ÓÐЧµÄÄÚ´æ¡£
ÕâÊÇÒ»¸öÈÃÎÞÊýÈËÀ§ÈŵÄÎÊÌâ¡£Èç¹ûÄãÒ»²»Ð¡ÐÄ£¬Äã¾ÍºÜÓпÉÄÜÔÚÕâ¸öÉÏÃæ·¸´íÎó¡£µ±È»Ä¿Ç°Óкܶà½â¾ö·½·¨£¬Èç¹ûÄãÊìϤһЩ±ê×¼¿âµÄ»°£¬Äã¿ÉÒÔ¿´µ½Ðí¶à¸÷ʽ¸÷ÑùµÄ½â¾ö·½·¨¡£´óÌåÀ´ËµÓÐÏÂÃ漸ÖÖ£º
1£©
ÔÚº¯ÊýÄÚ²¿Í¨¹ýmalloc»ònewÔÚ¶ÑÉÏ·ÖÅäÄڴ棬Ȼºó°ÑÕâ¿éÄÚ´æ·µ»Ø£¨ÒòΪÔÚ¶ÑÉÏ·ÖÅäµÄÄÚ´æÊÇÈ«¾Ö¿É¼ûµÄ£©¡£ÕâÑù´øÀ´µÄÎÊÌâ¾ÍÊÇDZÔÚµÄÄÚ´æÎÊÌâ¡£Òò
Ϊ£¬Èç¹û·µ»Ø³öÈ¥µÄÄÚ´æ²»ÊÍ·Å£¬ÄÇô¾ÍÊÇmemory
Leak¡£»òÕßÊDZ»¶à´ÎÊÍ·Å£¬´Ó¶øÔì³É³ÌÐòµÄcrash¡£ÕâÁ½¸öÎÊÌⶼÏ൱µÄÑÏÖØ£¬ËùÒÔÕâÖÖÉè¼Æ·½·¨²¢²»ÍƼö¡££¨ÔÚһЩWindows
APIÖУ¬µ±Äãµ÷ÓÃÁËһЩAPIºó£¬Äã±ØÐèÒ²Òªµ÷ÓÃËûµÄijЩAPIÀ´ÊÍ·ÅÕâ¿éÄڴ棩
2£©ÈÃÓû§´«ÈëÒ»¿éËû×Ô¼ºµÄÄÚ´æµØÖ·£¬¶øÔÚº¯ÊýÖаÑÒª
·µ»ØµÄÄÚ´æ·Åµ½Õâ¿éÄÚ´æÖС£ÕâÊÇÒ»¸öÄ¿Ç°ÆÕ±éʹÓõķ½Ê½¡£ºÜ¶àWind ......
C/C++·µ»ØÄÚ²¿¾²Ì¬³ÉÔ±µÄÏÝÚå
³Âð©
±³¾°
ÔÚÎÒÃÇÓÃ
C/C++¿ª·¢µÄ¹ý³ÌÖУ¬×ÜÊÇÓÐÒ»¸öÎÊÌâ»á¸øÎÒÃÇ´øÀ´¿àÄÕ¡£Õâ¸öÎÊÌâ¾ÍÊǺ¯ÊýÄںͺ¯ÊýÍâ´úÂëÐèҪͨ¹ýÒ»¿éÄÚ´æÀ´½»»¥£¨±ÈÈ磬º¯Êý·µ»Ø×Ö·û´®£©£¬Õâ¸öÎÊÌâÀ§
Èźͺܶ࿪·¢ÈËÔ±¡£Èç¹ûÄãµÄÄÚ´æÊÇÔÚº¯ÊýÄÚÕ»ÉÏ·ÖÅäµÄ£¬ÄÇôÕâ¸öÄÚ´æ»áËæן¯ÊýµÄ·µ»Ø¶ø±»µ¯Õ»ÊÍ·Å£¬ËùÒÔ£¬ÄãÒ»¶¨Òª·µ»ØÒ»¿éº¯ÊýÍⲿ»¹ÓÐЧµÄÄÚ´æ¡£
ÕâÊÇÒ»¸öÈÃÎÞÊýÈËÀ§ÈŵÄÎÊÌâ¡£Èç¹ûÄãÒ»²»Ð¡ÐÄ£¬Äã¾ÍºÜÓпÉÄÜÔÚÕâ¸öÉÏÃæ·¸´íÎó¡£µ±È»Ä¿Ç°Óкܶà½â¾ö·½·¨£¬Èç¹ûÄãÊìϤһЩ±ê×¼¿âµÄ»°£¬Äã¿ÉÒÔ¿´µ½Ðí¶à¸÷ʽ¸÷ÑùµÄ½â¾ö·½·¨¡£´óÌåÀ´ËµÓÐÏÂÃ漸ÖÖ£º
1£©
ÔÚº¯ÊýÄÚ²¿Í¨¹ýmalloc»ònewÔÚ¶ÑÉÏ·ÖÅäÄڴ棬Ȼºó°ÑÕâ¿éÄÚ´æ·µ»Ø£¨ÒòΪÔÚ¶ÑÉÏ·ÖÅäµÄÄÚ´æÊÇÈ«¾Ö¿É¼ûµÄ£©¡£ÕâÑù´øÀ´µÄÎÊÌâ¾ÍÊÇDZÔÚµÄÄÚ´æÎÊÌâ¡£Òò
Ϊ£¬Èç¹û·µ»Ø³öÈ¥µÄÄÚ´æ²»ÊÍ·Å£¬ÄÇô¾ÍÊÇmemory
Leak¡£»òÕßÊDZ»¶à´ÎÊÍ·Å£¬´Ó¶øÔì³É³ÌÐòµÄcrash¡£ÕâÁ½¸öÎÊÌⶼÏ൱µÄÑÏÖØ£¬ËùÒÔÕâÖÖÉè¼Æ·½·¨²¢²»ÍƼö¡££¨ÔÚһЩWindows
APIÖУ¬µ±Äãµ÷ÓÃÁËһЩAPIºó£¬Äã±ØÐèÒ²Òªµ÷ÓÃËûµÄijЩAPIÀ´ÊÍ·ÅÕâ¿éÄڴ棩
2£©ÈÃÓû§´«ÈëÒ»¿éËû×Ô¼ºµÄÄÚ´æµØÖ·£¬¶øÔÚº¯ÊýÖаÑÒª
·µ»ØµÄÄÚ´æ·Åµ½Õâ¿éÄÚ´æÖС£ÕâÊÇÒ»¸öÄ¿Ç°ÆÕ±éʹÓõķ½Ê½¡£ºÜ¶àWind ......