Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

C/C++ ±à³ÌÖжà¹úÓïÑÔ´¦Àí

ÎÊÌâµÄÌá³ö
¡¡¡¡¶à¹úÓïÑԵĴæÔÚ¡¢²»Í¬ÓïÑÔ²Ù×÷ϵͳµÄ´æÔÚ£¬Ê¹µÃÕë¶Ô¶àÓïÑÔµÄÉè¼ÆÆÄ·ÑÖÜÕ£¬ÔÚ±àÂëÉÏËù¸¶³öµÄ¹¤×÷Á¿Ò²Êǿɹ۵ġ£Ëùν±àÂëµÄÎÊÌ⣬¹é½áÆðÀ´£¬¾ÍÊǶþ½øÖƵıàÂëÒÔºÎÖÖ±àÂë¸ñʽ½øÐнâÎöµÄÎÊÌâ¡£ÌرðÊÇÔÚÓ²ÅÌÎļþºÍÄÚ´æÊý¾ÝµÄÏ໥ת»¯¡¢¼´¶Áд¹ý³ÌÖУ¬Èç¹û²ÉÓÃÁË´íÎóµÄ±àÂë¸ñʽ£¬¾Í»áÔì³ÉÂÒÂë¡£JAVA ÓïÑÔÔÚ×Ö·û´®¡¢±àÂëµÈ´¦Àí·½Ãæ¸øÁ˳ÌÐòÔ±¸üΪֱ½Ó¡¢·½±ãµÄ½Ó¿Ú£¬Ï°¹ßʹÓà JAVA ×ö±àÂëµÄ³ÌÐòÔ±£¬ÔÚʹÓà C/C++ ½øÐÐÎı¾±àÂëÏà¹ØµÄ²Ù×÷ʱ£¬³£»á¸Ðµ½À§»ó¡£±¾ÎĵÄÄ¿µÄÔÚÓÚÒÔ³£ÓÃµÄ Unicode£¨UCS-2£©¡¢GB2312¡¢UTF8 ÈýÖÖ±àÂëΪÀý£¬·ÖÎö²»Í¬±àÂëÔÚʵÓÃÖеĹØϵ£¬ÌرðÊÇ C/C++ ÖУ¬ÔõÑù´¦Àí¸÷ÖÖ±àÂëµÄÎÊÌâ¡£
¡¡¡¡±àÂë´¦Àí³£¼ûµÄÎÊÌâ
¡¡¡¡1. ½«ÄÚ´æÖбàÂë A µÄ×Ö·û´®ÒÔ±àÂë B ¸ñʽ´¦Àí³É×Ö½ÚÁ÷дÈëÎļþ
¡¡¡¡2. ½«Ô­±¾ÒÔ A ±àÂë×é³ÉµÄÎļþÒÔ×Ö½ÚÁ÷ÐÎʽ¶ÁÈëÄÚ´æ¡¢²¢ÒÔ±àÂë B ½âÎöΪ×Ö·û´®¡£
¡¡¡¡µÚÒ»ÖÖÇé¿ö£¬¿ÉÄÜÔì³ÉÊý¾ÝµÄ±ä»¯¡¢Ê§Õæ¡£
Èç¹ûʹÓà JAVA ÓïÑÔ£¬·¢ÉúÕâÖÖ´íÎóµÄÇé¿öÉÔÉÙһЩ£¬ÒòΪÔÚ JAVA ÖÐûÓÐ wstring ÕâÖÖ¸ÅÄÔÚÄÚ´æÖÐµÄ String£¬Ê¹ÓõıàÂ붼ÊÇ Unicode£¬ÆäÖеÄת»»¶ÔÓÚ³ÌÐòÔ±À´½²ÊÇ͸Ã÷µÄ¡£Ö»ÒªÊ¹ÓÃÊäÈë / Êä³ö·½·¨Ê±×¢Òâ×Ö½ÚÁ÷µÄ×Ö·û¼¯Ñ¡Ôñ¼´¿É¡£
ÀýÈ磬±àÂëΪÖÐÎÄ GB2312 µÄ“±ê×¼”×Ö·û´®±»¶ÁÈëÄÚ´æºóת´æΪ UTF8 µÄ¹ý³Ì£º
ͼ 1. Îļþת»»±àÂëµÄ JAVA ´¦Àí·½Ê½
¡¡¡¡µ« C/C++ ±à³Ì£¬ÓÉÓÚͨ³£Ê¹Óà char¡¢string ÀàÐ͵Äʱºò±È½Ï¶à£¬ÌرðÊǽøÐÐÎļþ¶Áд£¬»ù±¾¶¼ÊDzÙ×÷ char* ÀàÐ͵ÄÊý¾Ý¡£²¢ÇÒҲûÓÐÏñ JAVA ÖÐ getByte(String charsetname) ÕâÖÖº¯Êý£¬²»ÄÜÖ±½Ó¸ù¾Ý×Ö·û¼¯ÖØбàÂëµÃµ½×Ö·û´®µÄ byte Êý×é¡£Õâʱºò£¬ÎÒÃÇʹÓÃµÄ string Æäʵ¾ÍÒ»°ã²»ÊÇ Unicode£¬¶øÊÇ·ûºÏijÖÖ±àÂë±íµÄ¡£ÕâʹµÃÎÒÃÇÍùÍùÀ§»óÓÚ string µÄ±àÂëÎÊÌâ¡£¼ÙÉèÓÐ utf8 µÄ×Ö·û´®“Ò»”(E4 B8 80)£¬¶øÎÒÃÇ´íÎóµÄÈÏΪËüÊÇ·ûºÏ gb2312£¨±àÂë A£©µÄ£¬²¢½«Æäת»»Îª utf8£¨±àÂë B£©£¬ÕâÖÖת»»½á¹ûÊÇÆÆ»µÐԵģ¬´íÎóµÄÊä³ö½«ÓÀÔ¶ÎÞ·¨Õýȷʶ±ð¡£
ÒÀÈ»ÒÔ“±ê×¼”ΪÀý£¬ÕâÊÇÒ»¸öÕýÈ·µÄת»»£º
ͼ 2. Îļþת»»±àÂëµÄ C/C++ ´¦Àí·½Ê½
µÚ¶þÖÖÇé¿ö£¬ÔòÊǸü³£¼ûµ½µÄ¡£ÀýÈ磺ä¯ÀÀÆ÷ä¯ÀÀÍøҳʱµÄ·¢ÉúµÄÂÒÂëÎÊÌ⣻ÔÚд XML Îļþʱ£¬Ö¸¶¨ÁË < ?xml version="1.0" encoding="utf-8" ?> È»¶øÎļþÖÐÈ´°üº¬ GB2312 µÄ×Ö·û´®——ÕâÑù¾­³£»áµ¼Ö XML Îļþ bad formatted£¬¶øʹµÃ½âÎöÆ÷³ö´í¡£
ÕâÖÖÇé¿öÏ£¬ÆäʵÊý¾Ý¶¼ÊÇÕýÈ·µÄ£


Ïà¹ØÎĵµ£º

C/C++Ó﷨֪ʶ£ºtypedef struct Ó÷¨Ïê½â

µÚһƪ£ºtypedef structÓëstructµÄÇø±ð
1. »ù±¾½âÊÍ
typedefΪCÓïÑԵĹؼü×Ö£¬×÷ÓÃÊÇΪһÖÖÊý¾ÝÀàÐͶ¨ÒåÒ»¸öÐÂÃû×Ö¡£ÕâÀïµÄÊý¾ÝÀàÐÍ°üÀ¨ÄÚ²¿Êý¾ÝÀàÐÍ£¨int,charµÈ£©ºÍ×Ô¶¨ÒåµÄÊý¾ÝÀàÐÍ
£¨structµÈ£©¡£
ÔÚ±à³ÌÖÐʹÓÃtypedefÄ¿µÄÒ»°ãÓÐÁ½¸ö£¬Ò»¸öÊǸø±äÁ¿Ò»¸öÒ×¼ÇÇÒÒâÒåÃ÷È·µÄÐÂÃû×Ö£¬ÁíÒ»¸öÊǼò»¯Ò»Ð©±È½Ï¸´ÔÓµÄÀàÐÍÉùÃ÷ ......

ʹÓÃc#´´½¨sql serverµÄ´æ´¢¹ý³Ì_c#Ó¦ÓÃ2

{
SqlConnection cnn = new SqlConnection
("context connection=true");
cnn.Open();
SqlCommand cmd = new SqlCommand();
cmd.Connection = cnn;
cmd.CommandText = "select * from customers";
SqlDataReader reader = cmd.ExecuteReader();
SqlContext.Pipe.Send(reader);
reader.Close();
cnn.Close();
}
......

Æäʵ»Øµ÷º¯Êý²¢²»ÉñÃØ C/C++Öлص÷º¯Êý³õ̽

¼ò½é
¡¡¡¡¶ÔÓںܶà³õѧÕßÀ´Ëµ£¬ÍùÍù¾õµÃ»Øµ÷º¯ÊýºÜÉñÃØ£¬ºÜÏëÖªµÀ»Øµ÷º¯ÊýµÄ¹¤×÷Ô­Àí¡£±¾ÎĽ«Òª½âÊÍʲôÊǻص÷º¯Êý¡¢ËüÃÇÓÐʲôºÃ´¦¡¢ÎªÊ²Ã´ÒªÊ¹ÓÃËüÃǵȵÈÎÊÌ⣬ÔÚ¿ªÊ¼Ö®Ç°£¬¼ÙÉèÄãÒѾ­ÊìÖªÁ˺¯ÊýÖ¸Õë¡£
¡¡¡¡Ê²Ã´Êǻص÷º¯Êý£¿
¡¡¡¡¼ò¶øÑÔÖ®£¬»Øµ÷º¯Êý¾ÍÊÇÒ»¸öͨ¹ýº¯ÊýÖ¸Õëµ÷Óõĺ¯Êý¡£Èç¹ûÄã°Ñº¯ÊýµÄÖ¸Õë(µØÖ·)×÷Ϊ²ÎÊý ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ