锘??xml version="1.0" encoding="utf-8" standalone="yes"?>
1.浣跨敤 August 2007 DirectX SDK.
2. 縐婚櫎鎵鏈夊拰dxtrans.h鏈夊叧鐨?br>
Remove anything to do with "dxtrans.h" and "IDXEffect" .
Say, for file "qedit.h"
//#include "dxtrans.h" -- Line 498
// IDxtCompositor //: public IDXEffect -- Line 837
// IDxtAlphaSetter //: public IDXEffect -- Line 1151
// IDxtJpeg //: public IDXEffect -- Line 1345
// IDxtKey //: public IDXEffect -- Line 1735
鎴戣繖閲屽彧鏄畝鍗曠殑涓簡銆?/pre>1 //涓婇潰鏄姞浜嗘祴璇曚唬鐮佺殑錛屾垜嫻嬭瘯浜嗕竴涓嬩技涔庢病闂銆?/pre>
2
3 #include "stdafx.h"
4 #include <windows.h>
5 #include <time.h>
6 #include <stdlib.h>
7
8 #define MAX_BUF_LEN 20 // buf len // 蹇呴』瑕佸ぇ浜?
9 int nRead = 0; // read pos
10 int nWrite = 0; // write pos
11 int buf[MAX_BUF_LEN] = {0}; // loop buf
12
13 #define NN 20000
14 __int64 sum = 0;
15 __int64 lose = 0;
16 __int64 total = (__int64)(1+NN)*(__int64)NN/2;
17 bool bWriteFinished = false;
18
19 void WriteBuf(int n)
20 {
21 int rpos = nRead;
22 int wpos = nWrite;
23 wpos++;
24 // buf婊★紙鍗硍rite鍙堣拷涓婁簡read錛? 娉ㄤ負浜嗛伩鍏嶄笌鍒濆鐘舵侀噸澶嶅垽鏂?br> 25 // 鎵浠ヨ繖閲屾渶鍚庝竴涓猙uf娌℃湁鍐欏氨璁や負宸茬粡婊′簡銆傛墍浠AX_BUF_LEN涓嶈兘涓?
26 // 榪欓噷錛岀洿鎺ヤ涪寮冭buf
27 if (wpos % MAX_BUF_LEN == rpos % MAX_BUF_LEN)
28 {
29 lose += n;
30 return;
31 }
32
33 buf[nWrite] = n;
34 nWrite++;
35 if (nWrite == MAX_BUF_LEN)
36 nWrite = 0;
37 }
38
39 int ReadBuf()
40 {
41 if (nWrite == nRead)
42 return -1;
43
44 int n = buf[nRead];
45 nRead++;
46 if (nRead == MAX_BUF_LEN)
47 nRead = 0;
48 return n;
49 }
50
51 DWORD WINAPI ReadThread(LPVOID lpParameter)
52 {
53 int tmp = 0;
54 int count = 0;
55 while (true)
56 {
57 //printf("ReadThread = %d\n", ReadBuf());
58 tmp = ReadBuf();
59 if (-1 != tmp)
60 {
61 count++;
62 sum += tmp;
63 if (count == NN)
64 {
65 printf ("ReadThread finished!\n");
66 break;
67 }
68 }
69 else if (bWriteFinished)
70 {
71 printf ("ReadThread finished222!\n");
72 break;
73 }
74
75 Sleep(rand() % 10);
76 }
77 return 0;
78 }
79
80 DWORD WINAPI WriteThread(LPVOID lpParameter)
81 {
82 int n = 0;
83 while (true)
84 {
85 n++;
86 WriteBuf(n);
87 if (n == NN)
88 {
89 printf ("WriteThread finished!\n");
90 bWriteFinished = true;
91 break;
92 }
93
94 Sleep(rand() % 10);
95 }
96 return 0;
97 }
98
99 int main(int argc, char* argv[])
100 {
101 srand(time(NULL));
102 // for (int i = 0; i < 10; i++)
103 // {
104 // printf ("rand = %d\n", rand() % 10);
105 // }
106
107 DWORD threadid[2] = {0};
108 HANDLE hThread[2] = {0};
109 int param = 0;
110 hThread[0] = CreateThread(NULL, 0, ReadThread, ¶m, CREATE_SUSPENDED, &threadid[0]);
111 ResumeThread(hThread[0]);
112 hThread[1] = CreateThread(NULL, 0, WriteThread, ¶m, CREATE_SUSPENDED, &threadid[1]);
113 ResumeThread(hThread[1]);
114
115 getchar();
116
117 printf ("total = %lld\n", total);
118 printf ("lose = %lld\n", lose);
119 printf ("sum = %lld\n", sum);
120
121 if (total == lose + sum)
122 {
123 printf ("loop buf works well!\n");
124 }
125 else
126 {
127 printf ("loop buf works wrong!\n");
128 }
129
130 return 0;
131 }
132娉ㄦ剰錛氳繖閲屽彧鍏佽涓涓嚎紼嬭錛屼竴涓嚎紼嬪啓銆傚鏋滄槸澶氫釜綰跨▼璇誨啓鐨勮瘽錛岄渶瑕侀攣錛?/pre>鍙﹀錛屽緢澶氱粏鑺傞兘娌¤冭檻榪涘幓
]]>
瀹氫箟錛?br> 灝嗗父鐢ㄧ殑鎴栧緢澶嶆潅鐨勫伐浣滐紝棰勫厛鐢⊿QL璇彞鍐欏ソ騫剁敤涓涓寚瀹氱殑鍚嶇О瀛樺偍璧鋒潵, 閭d箞浠ュ悗瑕佸彨鏁版嵁搴?/font>鎻愪緵涓庡凡瀹氫箟濂界殑瀛樺偍榪囩▼鐨勫姛鑳界浉鍚岀殑鏈嶅姟鏃?鍙渶璋冪敤execute,鍗沖彲鑷姩瀹屾垚鍛戒護銆?br> 璁插埌榪欓噷,鍙兘鏈変漢瑕侀棶錛氳繖涔堣瀛樺偍榪囩▼灝辨槸涓鍫哠QL璇彞鑰屽凡鍟婏紵
Microsoft鍏徃涓轟粈涔堣繕瑕佹坊鍔犺繖涓妧鏈憿?
閭d箞瀛樺偍榪囩▼涓庝竴鑸殑SQL璇彞鏈変粈涔堝尯鍒憿?
瀛樺偍榪囩▼鐨勪紭鐐癸細
1.瀛樺偍榪囩▼鍙湪鍒涢犳椂榪涜緙栬瘧錛屼互鍚庢瘡嬈℃墽琛屽瓨鍌ㄨ繃紼嬮兘涓嶉渶鍐嶉噸鏂扮紪璇戯紝鑰屼竴鑸琒QL璇彞姣忔墽琛屼竴嬈″氨緙栬瘧涓嬈?鎵浠ヤ嬌鐢ㄥ瓨鍌ㄨ繃紼嬪彲鎻愰珮鏁版嵁搴撴墽琛岄熷害銆?br> 2.褰撳鏁版嵁搴撹繘琛屽鏉傛搷浣滄椂(濡傚澶氫釜琛ㄨ繘琛孶pdate,Insert,Query,Delete鏃訛級錛屽彲灝嗘澶嶆潅鎿嶄綔鐢ㄥ瓨鍌ㄨ繃紼嬪皝瑁呰搗鏉ヤ笌鏁版嵁搴撴彁渚涚殑浜嬪姟澶勭悊緇撳悎涓璧蜂嬌鐢ㄣ?br> 3.瀛樺偍榪囩▼鍙互閲嶅浣跨敤,鍙噺灝戞暟鎹簱寮鍙戜漢鍛樼殑宸ヤ綔閲?br> 4.瀹夊叏鎬ч珮,鍙瀹氬彧鏈夋煇姝ょ敤鎴鋒墠鍏鋒湁瀵規寚瀹氬瓨鍌ㄨ繃紼嬬殑浣跨敤鏉?br> 瀛樺偍榪囩▼鐨勭綾伙細
1.緋葷粺瀛樺偍榪囩▼錛氫互sp_寮澶?鐢ㄦ潵榪涜緋葷粺鐨勫悇欏硅瀹?鍙栧緱淇℃伅.鐩稿叧綆$悊宸ヤ綔,
濡?nbsp; sp_help灝辨槸鍙栧緱鎸囧畾瀵硅薄鐨勭浉鍏充俊鎭?br> 2.鎵╁睍瀛樺偍榪囩▼ 浠P_寮澶?鐢ㄦ潵璋冪敤鎿嶄綔緋葷粺鎻愪緵鐨勫姛鑳?br> exec master..xp_cmdshell 'ping 10.8.16.1'
3.鐢ㄦ埛鑷畾涔夌殑瀛樺偍榪囩▼,榪欐槸鎴戜滑鎵鎸囩殑瀛樺偍榪囩▼
甯哥敤鏍煎紡
Create procedure procedue_name
[@parameter data_type][output]
[with]{recompile|encryption}
as
sql_statement
瑙i噴:
output錛氳〃紺烘鍙傛暟鏄彲浼犲洖鐨?br> with {recompile|encryption}
recompile:琛ㄧず姣忔鎵ц姝ゅ瓨鍌ㄨ繃紼嬫椂閮介噸鏂扮紪璇戜竴嬈?br> encryption:鎵鍒涘緩鐨勫瓨鍌ㄨ繃紼嬬殑鍐呭浼氳鍔犲瘑
濡?
琛╞ook鐨勫唴瀹瑰涓?br> 緙栧彿 涔﹀悕 浠鋒牸
001 C璇█鍏ラ棬 $30
002 PowerBuilder鎶ヨ〃寮鍙?nbsp; $52
瀹炰緥1:鏌ヨ琛˙ook鐨勫唴瀹圭殑瀛樺偍榪囩▼
create proc query_book
as
select * from book
go
exec query_book
瀹炰緥2:鍔犲叆涓絎旇褰曞埌琛╞ook,騫舵煡璇㈡琛ㄤ腑鎵鏈変功綾嶇殑鎬婚噾棰?br> Create proc insert_book
@param1 char(10),@param2 varchar(20),@param3 money,@param4 money output
with encryption ---------鍔犲瘑
as
insert book(緙栧彿,涔﹀悕錛屼環鏍鹼級 Values(@param1,@param2,@param3)
select @param4=sum(浠鋒牸) from book
go
鎵ц渚嬪瓙:
declare @total_price money
exec insert_book '003','Delphi 鎺т歡寮鍙戞寚鍗?,$100,@total_price
print '鎬婚噾棰濅負'+convert(varchar,@total_price)
go
瀛樺偍榪囩▼鐨?縐嶄紶鍥炲?
1.浠eturn浼犲洖鏁存暟
2.浠utput鏍煎紡浼犲洖鍙傛暟
3.Recordset
浼犲洖鍊肩殑鍖哄埆:
output鍜宺eturn閮藉彲鍦ㄦ壒嬈$▼寮忎腑鐢ㄥ彉閲忔帴鏀?鑰宺ecordset鍒欎紶鍥炲埌鎵ц鎵規鐨勫鎴風涓?nbsp;
瀹炰緥3錛氳鏈変袱涓〃涓篜roduct,Order,鍏惰〃鍐呭濡備笅錛?br> Product
浜у搧緙栧彿 浜у搧鍚嶇О 瀹㈡埛璁㈡暟
001 閽㈢瑪 30
002 姣涚瑪 50
003 閾呯瑪 100
Order
浜у搧緙栧彿 瀹㈡埛鍚?nbsp; 瀹㈡埛璁㈤噾
001 鍗楀北鍖?nbsp; $30
002 緗楁箹鍖?nbsp; $50
003 瀹濆畨鍖?nbsp; $4
璇峰疄鐜版寜緙栧彿涓鴻繛鎺ユ潯浠?灝嗕袱涓〃榪炴帴鎴愪竴涓復鏃惰〃,璇ヨ〃鍙惈緙栧彿.浜у搧鍚?瀹㈡埛鍚?璁㈤噾.鎬婚噾棰?
鎬婚噾棰?璁㈤噾*璁㈡暟,涓存椂琛ㄦ斁鍦ㄥ瓨鍌ㄨ繃紼嬩腑
浠g爜濡備笅:
Create proc temp_sale
as
select a.浜у搧緙栧彿,a.浜у搧鍚嶇О,b.瀹㈡埛鍚?b.瀹㈡埛璁㈤噾,a.瀹㈡埛璁㈡暟* b.瀹㈡埛璁㈤噾 as鎬婚噾棰?br> into #temptable from Product a inner join Order b on a.浜у搧緙栧彿=b.浜у搧緙栧彿
if @@error=0
print 'Good'
else
print 'Fail'
go
--------------------------------------------------------------------------------------------------------------------
瀛樺偍榪囩▼浠嬬粛
涓銆佸厛浠嬬粛涓涓嬩粈涔堟槸瀛樺偍榪囩▼
瀛樺偍榪囩▼鏄埄鐢⊿QL Server鎵鎻愪緵鐨凾ranact-SQL璇█鎵緙栧啓鐨勭▼搴忋俆ranact-SQL璇█鏄疭QL Server鎻愪緵涓撲負璁捐鏁版嵁搴撳簲鐢ㄧ▼搴忕殑璇█錛屽畠鏄簲鐢ㄧ▼搴忓拰SQL Server鏁版嵁搴撻棿鐨勪富瑕佺▼搴忓紡璁捐鐣岄潰銆傚畠濂芥瘮Oracle鏁版嵁搴撶郴緇熶腑鐨凱ro-SQL鍜孖nformix鐨勬暟鎹簱緋葷粺鑳藉涓殑Informix-4GL璇█涓鏍楓傝繖綾昏璦涓昏鎻愪緵浠ヤ笅鍔熻兘錛岃鐢ㄦ埛鍙互璁捐鍑虹鍚堝紩鐢ㄩ渶姹傜殑紼嬪簭錛?nbsp;
1)銆佸彉閲忚鏄?nbsp;
2)銆丄NSI鍏煎鐨凷QL鍛戒護(濡係elect,Update….)
3)銆佷竴鑸祦紼嬫帶鍒跺懡浠?if…else…銆亀hile….)
4)銆佸唴閮ㄥ嚱鏁?nbsp;浜屻佸瓨鍌ㄨ繃紼嬬殑涔﹀啓鏍煎紡
CREATE PROCEDURE [鎷ユ湁鑰?]瀛樺偍榪囩▼鍚峓;紼嬪簭緙栧彿]
[(鍙傛暟#1,…鍙傛暟#1024)]
[WITH
{RECOMPILE | ENCRYPTION | RECOMPILE, ENCRYPTION}
]
[FOR REPLICATION]
AS 紼嬪簭琛?nbsp;鍏朵腑瀛樺偍榪囩▼鍚嶄笉鑳借秴榪?28涓瓧銆傛瘡涓瓨鍌ㄨ繃紼嬩腑鏈澶氳瀹?024涓弬鏁?nbsp;
(SQL Server 7.0浠ヤ笂鐗堟湰),鍙傛暟鐨勪嬌鐢ㄦ柟娉曞涓?@鍙傛暟鍚?nbsp; 鏁版嵁綾誨瀷 [VARYING] [=鍐呭畾鍊糫 [OUTPUT]
姣忎釜鍙傛暟鍚嶅墠瑕佹湁涓涓?#8220;@”絎﹀彿,姣忎竴涓瓨鍌ㄨ繃紼嬬殑鍙傛暟浠呬負璇ョ▼搴忓唴閮ㄤ嬌鐢?鍙傛暟鐨勭被鍨嬮櫎浜咺MAGE澶栵紝鍏朵粬SQL Server鎵鏀寔鐨勬暟鎹被鍨嬮兘鍙嬌鐢ㄣ?nbsp;
[=鍐呭畾鍊糫鐩稿綋浜庢垜浠湪寤虹珛鏁版嵁搴撴椂璁懼畾涓涓瓧孌電殑榛樿鍊鹼紝榪欓噷鏄負榪欎釜鍙傛暟璁懼畾榛樿鍊箋俒OUTPUT]鏄敤鏉ユ寚瀹氳鍙傛暟鏄棦鏈夎緭鍏ュ張鏈夎緭鍑哄肩殑錛屼篃灝辨槸鍦ㄨ皟鐢ㄤ簡榪欎釜瀛樺偍榪囩▼鏃訛紝濡傛灉鎵鎸囧畾鐨勫弬鏁板兼槸鎴戜滑闇瑕佽緭鍏ョ殑鍙傛暟錛屽悓鏃朵篃闇瑕佸湪緇撴灉涓緭鍑虹殑錛屽垯璇ラ」蹇呴』涓篛UTPUT錛岃屽鏋滃彧鏄仛杈撳嚭鍙傛暟鐢紝鍙互鐢–URSOR錛屽悓鏃跺湪浣跨敤璇ュ弬鏁版椂錛屽繀欏繪寚瀹歏ARYING鍜孫UTPUT榪欎袱涓鍙ャ?nbsp;渚嬪瓙:
CREATE PROCEDURE order_tot_amt @o_id int,@p_tot int output AS
SELECT @p_tot = sum(Unitprice*Quantity)
FROM orderdetails
WHERE 艒rdered=@o_id渚嬪瓙璇存槑:
璇ヤ緥瀛愭槸寤虹珛涓涓畝鍗曠殑瀛樺偍榪囩▼order_tot_amt,榪欎釜瀛樺偍榪囩▼鏍規嵁鐢ㄦ埛杈撳叆鐨勫畾鍗旾D鍙風爜(@o_id),鐢卞畾鍗曟槑緇嗚〃(orderdetails)涓綆楄瀹氬崟閿鍞婚[鍗曚環(Unitprice)*鏁伴噺(Quantity)],榪欎竴閲戦閫氳繃@p_tot榪欎竴鍙傛暟杈撳嚭緇欒皟鐢ㄨ繖涓瀛樺偍榪囩▼鐨勭▼搴?nbsp;涓夈佸湪SQL Server涓墽琛屽瓨鍌ㄨ繃紼?/strong>
鍦⊿QL Server鐨勬煡璇㈠垎鏋愬櫒涓紝杈撳叆浠ヤ笅浠g爜:
declare @tot_amt int
execute order_tot_amt 1,@tot_amt output
select @tot_amt浠ヤ笂浠g爜鏄墽琛宱rder_tot_amt榪欎竴瀛樺偍榪囩▼錛屼互璁$畻鍑哄畾鍗曠紪鍙蜂負1鐨勫畾鍗曢攢鍞噾棰濓紝鎴戜滑瀹氫箟@tot_amt涓鴻緭鍑哄弬鏁幫紝鐢ㄦ潵鎵挎帴鎴戜滑鎵瑕佺殑緇撴灉
涓銆佹眽瀛楃紪鐮佺殑縐嶇被
姹夊瓧緙栫爜涓幇鍦ㄤ富瑕佺敤鍒扮殑鏈変笁綾伙紝鍖呮嫭GBK錛?span lang=EN-US>GB2312鍜?span lang=EN-US>Big5銆?/span>
1銆?span lang=EN-US>GB2312鍙堢О鍥芥爣鐮侊紝鐢卞浗瀹舵爣鍑嗘誨眬鍙戝竷錛?/span>1981騫?/span>5鏈?/span>1鏃ュ疄鏂斤紝閫氳浜庡ぇ闄嗐傛柊鍔犲潯絳夊湴涔熶嬌鐢ㄦ緙栫爜銆傚畠鏄竴涓畝鍖栧瓧鐨勭紪鐮佽鑼冿紝褰撶劧涔熷寘鎷叾浠栫殑絎﹀彿銆佸瓧姣嶃佹棩鏂囧亣鍚嶇瓑錛屽叡7445涓浘褰㈠瓧絎︼紝鍏朵腑姹夊瓧鍗?/span>6763涓傛垜浠鉤鏃惰6768涓眽瀛楋紝瀹為檯涓婇噷杈規湁5涓紪鐮佷負絀虹櫧錛屾墍浠ユ誨叡鏈?/span>6763涓眽瀛椼?/span>
GB2312瑙勫畾“瀵逛換鎰忎竴涓浘褰㈠瓧絎﹂兘閲囩敤涓や釜瀛楄妭琛ㄧず錛屾瘡涓瓧鑺傚潎閲囩敤涓冧綅緙栫爜琛ㄧず”錛屼範鎯笂縐扮涓涓瓧鑺備負“楂樺瓧鑺?#8221;錛岀浜屼釜瀛楄妭涓?#8220;浣庡瓧鑺?#8221;銆?/span>GB2312涓眽瀛楃殑緙栫爜鑼冨洿涓猴紝絎竴瀛楄妭0xB0-0xF7(瀵瑰簲鍗佽繘鍒朵負176-247)錛岀浜屼釜瀛楄妭0xA0-0xFE錛堝搴斿崄榪涘埗涓?span lang=EN-US>160-254錛夈?/span>
GB2312灝嗕唬鐮佽〃鍒嗕負94涓尯錛屽搴旂涓瀛楄妭錛?/span>0xa1-0xfe錛夛紱姣忎釜鍖?/span>94涓綅錛?/span>0xa1-0xfe錛夛紝瀵瑰簲絎簩瀛楄妭錛屼袱涓瓧鑺傜殑鍊煎垎鍒負鍖哄彿鍊煎拰浣嶅彿鍊煎姞32錛?/span>2OH錛夛紝鍥犳涔熺О涓哄尯浣嶇爜銆?/span>01-09鍖轟負絎﹀彿銆佹暟瀛楀尯錛?/span>16-87鍖轟負姹夊瓧鍖猴紙0xb0-0xf7錛夛紝10-15鍖恒?/span>88-94鍖烘槸鏈夊緟榪涗竴姝ユ爣鍑嗗寲鐨勭┖鐧藉尯銆?/span>
2銆?/span>Big5鍙堢О澶т簲鐮侊紝涓昏涓洪娓笌鍙版咕浣跨敤錛屽嵆鏄竴涓箒浣撳瓧緙栫爜銆?/span>姣忎釜姹夊瓧鐢變袱涓瓧鑺傛瀯鎴愶紝絎竴涓瓧鑺傜殑鑼冨洿浠?/span>0X81錛?/span>0XFE錛堝嵆129-255錛夛紝鍏?/span>126縐嶃傜浜屼釜瀛楄妭鐨勮寖鍥翠笉榪炵畫錛屽垎鍒負0X40錛?/span>0X7E錛堝嵆64-126錛夛紝0XA1錛?/span>0XFE錛堝嵆161-254錛夛紝鍏?/span>157縐嶃?/span>
3銆?span lang=EN-US>GBK鏄?span lang=EN-US>GB2312鐨勬墿灞曪紝鏄悜涓婂吋瀹圭殑錛屽洜姝?span lang=EN-US>GB2312涓殑姹夊瓧鐨勭紪鐮佷笌GBK涓眽瀛楃殑鐩稿悓銆傚彟澶栵紝GBK涓繕鍖呭惈綣佷綋瀛楃殑緙栫爜錛屽畠涓?span lang=EN-US>Big5緙栫爜涔嬮棿鐨勫叧緋繪垜榪樻病鏈夊紕鏄庣櫧錛屽ソ鍍忔槸涓嶄竴鑷寸殑銆?span lang=EN-US>GBK涓瘡涓眽瀛椾粛鐒跺寘鍚袱涓瓧鑺傦紝絎竴涓瓧鑺傜殑鑼冨洿鏄?span lang=EN-US>0x81-0xFE錛堝嵆129-254錛夛紝絎簩涓瓧鑺傜殑鑼冨洿鏄?span lang=EN-US>0x40-0xFE錛堝嵆64-254錛夈?span lang=EN-US>GBK涓湁鐮佷綅23940涓紝鍖呭惈姹夊瓧21003涓?/span>
琛?span lang=EN-US>1 姹夊瓧緙栫爜鑼冨洿
鍚嶇О |
絎竴瀛楄妭 |
絎簩瀛楄妭 |
GB2312 |
0xB0-0xF7(176-247) |
0xA0-0xFE錛?/span>160-254錛?/span> |
GBK |
0x81-0xFE錛?/span>129-254錛?/span> |
0x40-0xFE錛?/span>64-254錛?/span> |
Big5 |
0x81-0xFE錛?/span>129-255錛?/span> |
0x40-0x7E錛?/span>64-126錛?/span> 0xA1錛?/span>0xFE錛?/span>161-254錛?/span> |
浜屻佸姹夊瓧榪涜hash
涓轟簡澶勭悊姹夊瓧鐨勬柟渚匡紝鍦ㄦ煡鎵炬眽瀛楃殑鏃跺欙紝鎴戜滑閫氬父浼氱敤鍒?span lang=EN-US>hash鐨勬柟娉曪紝閭f庝箞鏉ョ‘瀹氫竴涓眽瀛椾綅緗憿錛熻繖灝卞拰姣忕緙栫爜鐨勬帓鍒楁湁鍏充簡錛岃繖閲屼富瑕佺粰鍑轟竴縐?span lang=EN-US>hash鍑芥暟鐨勭瓥鐣ャ?/span>
瀵逛簬GB2312緙栫爜錛岃杈撳叆鐨勬眽瀛椾負GBword錛屾垜浠彲浠ラ噰鐢ㄥ叕寮?span lang=EN-US>(C1-176)*94 + (C2-161)紜畾GBindex銆傚叾涓紝C1琛ㄧず絎竴瀛楄妭錛?span lang=EN-US>C2琛ㄧず絎簩瀛楄妭銆傚叿浣撳涓嬶細
GBindex = ((unsigned char)GBword.at(0)-176)*94 + (unsigned char)GBword.at(1) - 161;
涔嬫墍浠ョ敤unsigned char綾誨瀷錛屾槸鍥犱負char鏄竴涓瓧鑺傦紝濡傛灉鐢?span lang=EN-US>unsigend int錛屽洜涓?span lang=EN-US>int鏄?span lang=EN-US>4涓瓧鑺傜殑錛屾墍浠ヤ細閫犳垚鎵╁睍錛屽鑷撮敊璇?/span>
瀵逛簬GBK緙栫爜錛岃杈撳叆鐨勬眽瀛椾負GBKword錛屽垯鍙互閲囩敤鍏紡 index=(ch1-0x81)*190+(ch2-0x40)-(ch2/128)錛屽叾涓?span lang=EN-US>ch1鏄涓瀛楄妭錛?span lang=EN-US>ch2鏄浜屽瓧鑺傘?/span>
鍏蜂綋鐨勶紝
GBKindex = ((unsigned char)GBKword[0]-129)*190 +
((unsigned char)GBKword[1]-64) - (unsigned char)GBKword[1]/128;
涓夈佹庢牱鍒ゆ柇涓涓眽瀛楃殑鏄粈涔堢紪鐮?/span>
鐩存帴鏍規嵁姹夊瓧鐨勭紪鐮佽寖鍥村垽鏂紝瀵逛簬GB2312鍜?span lang=EN-US>GBK鍙敤涓嬮潰涓や釜紼嬪簭瀹炵幇銆?/span>
1銆佸垽鏂槸鍚︽槸GB2312
bool isGBCode(const string& strIn)
{
unsigned char ch1;
unsigned char ch2;
if (strIn.size() >= 2)
{
ch1 = (unsigned char)strIn.at(0);
ch2 = (unsigned char)strIn.at(1);
if (ch1>=176 && ch1<=247 && ch2>=160 && ch2<=254)
return true;
else return false;
}
else return false;
}
2銆佸垽鏂槸鍚︽槸GBK緙栫爜
bool isGBKCode(const string& strIn)
{
unsigned char ch1;
unsigned char ch2;
if (strIn.size() >= 2)
{
ch1 = (unsigned char)strIn.at(0);
ch2 = (unsigned char)strIn.at(1);
if (ch1>=129 && ch1<=254 && ch2>=64 && ch2<=254)
return true;
else return false;
}
else return false;
}
3銆佸浜?span lang=EN-US>Big5
瀹冪殑鑼冨洿涓猴細楂樺瓧鑺備粠0xA0鍒?span lang=EN-US>0xFE錛屼綆瀛楄妭浠?span lang=EN-US>0x40鍒?span lang=EN-US>0x7E錛屽拰0xA1鍒?span lang=EN-US>0xFE涓ら儴鍒嗐傚垽鏂竴涓眽瀛楁槸鍚︽槸BIG5緙栫爜錛屽彲浠ュ涓婂瀛楃鐨勭紪鐮佽寖鍥村垽鏂嵆鍙傚浣曞畾浣嶅憿錛熼偅涔堜篃鎯寵薄鎵鏈夌紪鐮佹帓鍒椾負涓涓簩緇村潗鏍囷紝綰靛潗鏍囨槸楂樺瓧鑺傦紝妯潗鏍囨槸浣庡瓧鑺傘傝繖鏍蜂竴琛屼笂鐨勬眽瀛椾釜鏁幫細(0x7E-0x40+1)+(0xFE-0xA1+1)錛?span lang=EN-US>157銆傞偅涔堝畾浣嶇畻娉曞垎涓ゅ潡錛屼負:
if 0x40<=ch2<=0x7E: #is big5 char
index=((ch1-0xA1)*157+(ch2-0x40))*2
elif 0xA1<=ch2<=0xFE: #is big5 char
index=((ch1-0xA1)*157+(ch2-0xA1+63))*2
瀵逛簬絎簩鍧楋紝璁$畻鍋忕Щ閲忔椂鍥犱負鏈変袱鍧楁暟鍊鹼紝鎵浠ュ湪璁$畻鍚庨潰涓孌靛兼椂錛屼笉瑕佸繕浜嗗墠闈㈣繕鏈変竴孌靛箋?span lang=EN-US>0x7E-0x40+1=63銆?/span>
鍥涖佸鏋滃垽鏂竴涓瓧絎︽槸瑗挎枃瀛楃榪樻槸涓枃瀛楃
澶у鐭ラ亾瑗挎枃瀛楃涓昏鏄寚ASCII鐮侊紝瀹冪敤涓涓瓧鑺傝〃紺恒備笖榪欎釜瀛楃杞崲鎴愭暟瀛椾箣鍚庯紝璇ユ暟瀛楁槸澶т簬0鐨勶紝鑰屾眽瀛楁槸涓や釜瀛楄妭鐨勶紝絎竴涓瓧鑺傜殑杞寲涓烘暟瀛椾箣鍚庡簲璇ユ槸灝忎簬0鐨勶紝鍥犳鍙互鏍規嵁姣忎釜瀛楄妭杞寲涓烘暟瀛椾箣鍚庢槸鍚﹀皬浜?span lang=EN-US>0錛屽垽鏂畠鏄惁鏄眽瀛椼?/span>
渚嬪錛岃杈撳叆瀛椾負strin錛屽垯錛?/span>
If (strin.at(0) < 0)
cout << ”鏄眽瀛?span lang=EN-US>” << endl;
else cout << ”涓嶆槸姹夊瓧” << endl;
甯哥敤鏁版嵁綾誨瀷浣跨敤杞崲璇﹁В
璇昏呭眰嬈★細鍒濆 int i = 100;
浜屻佸瓧絎︿覆杞崲涓哄叾瀹冩暟鎹被鍨?/font>
涓夈佸叾瀹冩暟鎹被鍨嬭漿鎹㈠埌CString
鍥涖丅STR銆乢bstr_t涓嶤ComBSTR
浜斻乂ARIANT 銆乢variant_t 涓?COleVariant
鍏佸叾瀹冧竴浜汣OM鏁版嵁綾誨瀷
涓冦丄NSI涓嶶nicode
鍏佸叾瀹?/strong>
涔濄佹敞鎰忎簨欏?/strong> 鍚庤錛氭湰鏂囧寙鍖嗗啓鎴愶紝閿欒涔嬪鍦ㄦ墍闅懼厤錛屾榪庢寚姝? |
閫氳繃涓婁竴嬈$殑鏁欑▼鍚庯紝澶у閮藉簲璇ヤ細浣跨敤boost.python浜嗐傛妸c++紼嬪簭緙栬瘧鎴恜yd鏂囦歡銆傜敱浜巆++鏈夊緢澶氱壒鎬э紝鎵浠ワ紝濡傛灉浣犵殑紼?/p>
搴忕敤浜嗗緢澶氱殑c++鐗規х殑璇濓紝閭d箞浣犲繀欏誨仛寰堝宸ヤ綔浜嗐傚儚铏氭嫙鍑芥暟錛屽嚱鏁伴噸杞斤紝緇ф壙錛岄粯璁ゅ肩瓑絳夈傚叿浣撳浣曡漿鍖栵紝璇峰弬
boost.python鐨勬枃妗d簡銆?/p>
榪欏嚑澶╁皾璇曠潃鎶奵++紼嬪簭搴撶紪璇戞垚python鍙皟鐢ㄧ殑dll錛屼笉鐭ラ亾涓轟粈涔堜竴鐩翠笉鍙敤銆傘傚緢鏄儊闂楓傝佹槸鏄劇ず濡備笅鐨勯敊璇細
Traceback (most recent call last):
File "<pyshell#3>", line 1, in <module>
import pydll
ImportError: No module named pydll
鎰忔濇槸璇存壘涓嶅埌dll銆傛垜鎶奷ll閮絚opy鍒皃ython/dlls涓嬩簡榪樻槸涓嶈錛岃屼笖鎴戠‘瀹歱ython鐨剆ys.path鍖呭惈浜唒ython/dlls鐩綍浜嗐?/p>
寰堟槸涓嶈В銆傜綉涓婁篃寰堥毦鎵懼埌璧勬枡錛実oogle浜嗗緢闀挎椂闂存壘涓嶅埌鏈夌敤鐨勮祫鏂欙紝濂藉儚涓枃鏂歸潰鐨勮祫鏂欏緢灝戠殑銆備粖澶╁皾璇曚簡涓涓媑oogle
鑻辨枃璧勬枡錛岀粓浜庢湁浜嗘柊鐨勫彂鐜幫細
http://mail.python.org/pipermail/c++-sig/2007-February/011971.html
You are using Python2.5. In this version of Python you have to have
file extension
to be "pyd" - sge.pyd
--
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/
鏈変漢紕板埌鐨勯棶棰樿窡鎴戠殑鏄竴鏍風殑銆傚悗闈㈤偅涓猂oman鍥炵瓟浜嗕竴涓嬶紝鏄枃浠舵墿灞曞悕鐨勯棶棰橈紒錛侊紒涓轟粈涔堜笉鏀寔dll鍛紵涓嶈В銆傚洖鍘昏瘯
浜嗕竴涓嬫妸鍚庣紑鍚嶆敼浜嗗氨鎴愬姛浜嗐傘傘倃hy???
涓嬮潰鏉ョ湅涓涓嬫垜鐨勯偅涓畝鍗曠殑渚嬪瓙錛?br>榪欎釜渚嬪瓙鏉ヨ嚜浜庣綉涓婏紝
http://www.vckbase.com/document/viewdoc/?id=1540
C++ 鎵╁睍鍜屽祵鍏?Python
浣滆咃細鑳¢噾灞?br>婧愮爜涓嬭澆鍦板潃錛?a >http://www.vckbase.com/code/downcode.asp?id=2777
榪欐槸涓涓潪甯哥畝鍗曠殑dll宸ョ▼銆傜粰python鎻愪緵浜嗕竴涓嚱鏁皊tatic PyObject* Recognise(PyObject *self, PyObject *args)銆?/p>
1銆佷笉浣跨敤boost.python搴撴潵鐩存帴鏋勫緩dll
鎺ヤ笅鏉ワ紝鎴戜滑鏉ョ敤C++涓篜ython緙栧啓鎵╁睍妯″潡(鍔ㄦ侀摼鎺ュ簱)錛屽茍鍦≒ython紼嬪簭涓皟鐢–++寮鍙戠殑鎵╁睍鍔熻兘鍑芥暟銆傜敓鎴愪竴涓彇鍚嶄負
pyUtil鐨刉in32 DLL宸ョ▼錛岄櫎浜唒yUtil.cpp鏂囦歡浠ュ錛屼粠宸ョ▼涓Щ闄ゆ墍鏈夊叾瀹冩枃浠訛紝騫跺~鍏ュ涓嬬殑浠g爜錛?
// pyUtil.cpp
#ifdef PYUTIL_EXPORTS
#define PYUTIL_API __declspec(dllexport)
#else
#define PYUTIL_API __declspec(dllimport)
#endif
#include<windows.h>
#include<string>
#include<Python.h>
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
std::string Recognise_Img(const std::string url)
{
//榪斿洖緇撴灉
return "浠巇ll涓繑鍥炵殑鏁版嵁... : " +url;
}
static PyObject* Recognise(PyObject *self, PyObject *args)
{
const char *url;
std::string sts;
if (!PyArg_ParseTuple(args, "s", &url))
return NULL;
sts = Recognise_Img(url);
return Py_BuildValue("s", sts.c_str() );
}
static PyMethodDef AllMyMethods[] = {
{"Recognise", Recognise, METH_VARARGS},//鏆撮湶緇橮ython鐨勫嚱鏁?br> {NULL, NULL} /* Sentinel */
};
extern "C" PYUTIL_API void initpyUtil()
{
PyObject *m, *d;
m = Py_InitModule("pyUtil", AllMyMethods); //鍒濆鍖栨湰妯″潡錛屽茍鏆撮湶鍑芥暟
d = PyModule_GetDict(m);
}
鍦≒ython浠g爜涓皟鐢ㄨ繖涓姩鎬侀摼鎺ュ簱錛?(璁板緱鎶奷ll鐨勬墿灞曞悕鏀逛負.pyd錛屽彟澶杁ll鐨勮礬寰勮鑳藉琚绱㈠埌)
import pyUtil
result = pyUtil.Recognise("input url of specific data")
print "the result is: "+ result
2銆佷嬌鐢╞oost.python搴撴潵鏋勫緩dll
鐢–++涓篜ython鍐欐墿灞曟椂錛屽鏋滄偍鎰挎剰浣跨敤Boost.Python搴撶殑璇濓紝寮鍙戣繃紼嬩細鍙樺緱鏇村紑蹇僇錛岃緙栧啓涓涓笌涓婅堪pyUtil鍚屾牱鍔熻兘
鐨勫姩鎬侀摼鎺ュ簱錛屽彧闇鎶婃枃浠跺唴瀹規浛鎹負涓嬮潰鐨勪唬鐮併傚綋鐒訛紝緙栬瘧闇瑕乥oost_python.lib鏀寔錛岃繍琛岄渶瑕乥oost_python.dll鏀寔
銆?
#include<string>
#include <boost/python.hpp>
using namespace boost::python;
#pragma comment(lib, "boost_python.lib")
std::string strtmp;
char const* Recognise(const char* url)
{
strtmp ="浠巇ll涓繑鍥炵殑鏁版嵁... : ";
strtmp+=url;
return strtmp.c_str();
}
BOOST_PYTHON_MODULE(pyUtil)
{
def("Recognise", Recognise);
}
鍙互闈炲父鏄庢樉鍦扮湅鍒幫紝鐢ㄤ簡boost.python搴撲箣鍚庯紝綆鍗曚簡寰堝銆傚洜涓篵oost.python涓轟綘鍋氫簡寰堝鐨勪簨鎯呫傘傛仼銆?/p>
濂藉儚娌℃湁璁插緢澶氭湁鐢ㄧ殑涓滆タ錛屽厜欏劇潃璁蹭簡錛屽懙鍛點傘傘傛垜涔熻繕鍦ㄧ戶緇涔犱箣涓備笅嬈″啓鐐逛粈涔堝憿錛熺戶緇涔犱簡鍝?/p>
鏈変竴孌墊椂闂存病鍐檅log浜嗐傝繖鍑犲ぉ閮藉湪鐮旂┒鎬庝箞灝佽c++錛岃python鍙互鐢╟++鐨勫簱銆傚湪緗戜笂鍙戠幇浜哹oost.python榪欎釜濂藉挌鍜氥備笉
榪囧湪浣跨敤榪囩▼涓鍒頒竴鐐歸棶棰樸傛湰鏂囨暀澶у濡備綍鎶?/p>
char const* greet()
{
return "hello, world";
}
灝佽鎴恜ython銆傚疄闄呬笂榪欐槸python鏁欑▼閲岄潰鐨勫挌鍜氥?/p>
棣栧厛涓嬭澆Boost錛?a >www.boost.org銆俠oost.python鍦╞oost閲岄潰浜嗐傚湪visual studio 2005 command prompt涓璶avigation鍒?/p>
boost\boost_1_34_0\涓嬨傝寰椾竴瀹氳鐢╲isual studio 2005 command prompt榪欎釜vs2005甯︾殑tools錛屼笉瑕佺敤cmd.exe錛屽惁鍒欎細
紕板埌寰堝閿欒鐨勩傜劧鍚庡氨鏄妸bjam.exe鎷瘋礉鍒頒竴涓兘琚壘鍒扮殑鐩綍涓嬶紝鎴栬呯洿鎺ヤ篃鎷瘋礉鍒癰oost\boost_1_34_0\涓嬪嵆鍙傜劧鍚庯紝
璁劇疆python鐨勬牴鐩綍鍜宲ython鐨勭増鏈紝涔熷彲鐩存帴鎶婂畠浠姞鍒板潖澧冪洰褰曚腑錛岄偅鏍峰氨涓嶇敤姣忔閮借緗竴涓嬨?br>set PYTHON_ROOT=c:/python25
set PYTHON_VERSION=2.5
鎺ョ潃灝卞彲浠ョ洿鎺ヨ繍琛屼簡錛宐jam -sTOOLS=vc-8_0
鏁翠釜緙栬瘧榪囩▼瑕佸緢闀挎椂闂淬傘傘?/p>
鎴愬姛涔嬪悗錛屽氨浼氭湁濂藉涓猙oost_python-vc80-****.dll,.lib鐨勶紝鎶婁粬浠兘鎷瘋礉鍒頒竴涓兘琚郴緇熸壘鍒扮殑鐩綍錛屼笉濡ㄧ洿鎺ユ妸浠栦滑閮?/p>
鎵斿埌c:\windows\system32涓嬨?/p>
鎺ョ潃錛屾垜浠紑濮嬬紪璇慼ello銆俷avigation鍒癰oost\boost_1_34_0\libs\python\example\tutorial涓嬶紝bjam -sTOOLS=vc-8_0榪愯
錛屽湪bin鐨勭洰褰曚笅鍗充細鐢熸垚hello.pyd銆傝繖涓嬪氨鍩烘湰鎴愬姛浜嗭紝濡傛灉娌℃垚鍔熺殑璇濓紝check涓涓嬩笂闈oost_python鐨勯偅浜沝ll鑳藉惁琚郴
緇熸壘鍒般傚彟澶栵紝榪欓噷鏈塸ython25鐨勪竴涓猙ug銆傘傘傛垜鑺變簡寰堥暱鏃墮棿鎵嶅湪python鐨刴ail lists涓壘鍒頒簡銆傚瘨銆傘傘?/p>
閿欒濡備笅鎵紺猴細
D:\Learn\Python\boost\boost_1_34_0\libs\python\example\tutorial>bjam
Jamroot:17: in modules.load
rule python-extension unknown in module Jamfile</D:/Learn/Python/boost/boost_1_3
4_0/libs/python/example/tutorial>.
D:/Learn/Python/boost/boost_1_34_0/tools/build/v2/build\project.jam:312: in load
-jamfile
D:/Learn/Python/boost/boost_1_34_0/tools/build/v2/build\project.jam:68: in load
D:/Learn/Python/boost/boost_1_34_0/tools/build/v2/build\project.jam:170: in proj
ect.find
D:/Learn/Python/boost/boost_1_34_0/tools/build/v2\build-system.jam:237: in load
D:\Learn\Python\boost\boost_1_34_0\libs\python\example\..\..\..\tools\build\v2/k
ernel\modules.jam:261: in import
D:\Learn\Python\boost\boost_1_34_0\libs\python\example\..\..\..\tools\build\v2/k
ernel/bootstrap.jam:132: in boost-build
D:\Learn\Python\boost\boost_1_34_0\libs\python\example\boost-build.jam:7: in mod
ule scope
瑙e喅鍔炴硶濡備笅錛?br>鍦╞oost\boost_1_34_0\tools\build\v2\鐩綍涓嬫壘鍒皍ser-config.jam鏂囦歡錛屾墦寮鍦?br>import toolset : using ;
涓嬮潰鍔犱竴琛屼唬鐮侊細
using python ;
鍐嶉噸鏂扮紪璇戜竴涓媌oost錛岀劧鍚庡氨娌¢棶棰樹簡銆倀utorial閲岄潰鐨刪ello鑳介『鍒╃紪璇戦氳繃銆俻s.榪欎釜闂鍥版壈浜嗘垜濂介暱鏃墮棿銆傘俿igh銆傘?/p>
銆?/p>
緙栬瘧鎴愬姛鍚庝細浜х敓涓涓猦ello.pyd錛屽湪bin鐨勭洰褰曚笅闈€?/p>
鏈夊ソ澶氬姙娉曟祴璇曟hello.pyd鏄惁鍙互鐢ㄣ?br>鏂規硶涓錛屾妸瀹冩嫹璐濆埌python25\dlls涓嬶紝鎵撳紑IDLE錛?br>>>> import hello
>>> hello.greet()
'hello, world'
>>>
鏂規硶浜岋紝鐩存帴鍦ㄥ綋鍓嶇洰褰曚笅鍐欎竴涓猵ython鏂囦歡錛岀劧鍚庣洿鎺ヨ皟鐢╤ello.pyd鍗沖彲銆傛諱箣錛宧ello.pyd灝辨槸涓涓猵ython鏂囦歡浜嗐傘傚棷
銆傛搷浣渉ello.pyd鏍瑰叾浠杙ython鏂囦歡鏄竴鏍風殑銆?br>榪欐牱灝辨垚鍔熶簡銆?/p>
濡傛灉紕板埌濡備笅閿欒錛屾槸鍥犱負緋葷粺鎵句笉鍒癰oost_python鐨刣ll銆傚己鐑堝緩璁妸浠栦滑閮芥墧鍒皊ystem32涓嬶紒銆?/p>
>>> import hello
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import hello
ImportError: DLL load failed: 鎵句笉鍒版寚瀹氱殑妯″潡銆?br>>>>
璇存槑錛宧ello.cpp鍦╞oost\boost_1_34_0\libs\python\example\tutorial鐩綍涓嬨傞噷闈㈢殑鍐呭鏄細
// Copyright Joel de Guzman 2002-2004. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt
// or copy at http://www.boost.org/LICENSE_1_0.txt)
// Hello World Example from the tutorial
// [Joel de Guzman 10/9/2002]
char const* greet()
{
return "hello, world";
}
#include <boost/python/module.hpp>
#include <boost/python/def.hpp>
using namespace boost::python;
BOOST_PYTHON_MODULE(hello)
{
def("greet", greet);
}
鍏朵腑
BOOST_PYTHON_MODULE(hello)
{
def("greet", greet);
}
鏄greet浠巆++鍚憄ython鐨勪竴涓皝瑁呭0鏄庡惂錛岃鎹㈠氨浜ょ粰boost浜嗐?/p>
鍏堝啓鍒拌繖閲屼簡銆備笅嬈″啀鍐欍傘傚棷
1. 棣栧厛璁茶鍏冪粍鐨勬搷浣?br>鐢變簬鍙傛暟鏄氳繃鍏冪粍浼犺繘鍘葷殑錛屾墍浠ユ垜浠笉鑳借佹槸閫氳繃Py_BuildValue榪欎釜鍑芥暟鏉ユ搷浣滃厓緇勶紝閭f牱澶笉鏂逛究浜嗐?br>Python鎻愪緵浜嗗厓緇勭浉鍏崇殑鎿嶄綔錛屼笅闈㈣繖涓緥瀛愭紨紺轟簡濡備綍鎿嶄綔銆備富瑕佹槸涓嬮潰鍑犱釜鍑芥暟錛?br>//new涓涓厓緇勶紝浼犲叆size
pArgs = PyTuple_New(argc - 3);
//set鍏冪粍鐨勭洿錛岀涓涓負鍏冪粍錛岀浜屼釜涓篿ndex錛堜粠0寮濮嬶級錛岀涓変釜涓簐alue
PyTuple_SetItem(pArgs,0,Py_BuildValue("i",2000) );
PyTuple_SetItem(pArgs,1,Py_BuildValue("i",8) );
鏉ヨ嚜python doc鐨勪竴涓緥瀛?/p>
#include <Python.h>
int
main(int argc, char *argv[])
{
PyObject *pName, *pModule, *pDict, *pFunc;
PyObject *pArgs, *pValue;
int i;
if (argc < 3) {
fprintf(stderr,"Usage: call pythonfile funcname [args]\n");
return 1;
}
Py_Initialize();
pName = PyString_FromString(argv[1]);
/* Error checking of pName left out */
pModule = PyImport_Import(pName);
Py_DECREF(pName);
if (pModule != NULL) {
pFunc = PyObject_GetAttrString(pModule, argv[2]);
/* pFunc is a new reference */
if (pFunc && PyCallable_Check(pFunc)) {
pArgs = PyTuple_New(argc - 3);
for (i = 0; i < argc - 3; ++i) {
pValue = PyInt_FromLong(atoi(argv[i + 3]));
if (!pValue) {
Py_DECREF(pArgs);
Py_DECREF(pModule);
fprintf(stderr, "Cannot convert argument\n");
return 1;
}
/* pValue reference stolen here: */
PyTuple_SetItem(pArgs, i, pValue);
}
pValue = PyObject_CallObject(pFunc, pArgs);
Py_DECREF(pArgs);
if (pValue != NULL) {
printf("Result of call: %ld\n", PyInt_AsLong(pValue));
Py_DECREF(pValue);
}
else {
Py_DECREF(pFunc);
Py_DECREF(pModule);
PyErr_Print();
fprintf(stderr,"Call failed\n");
return 1;
}
}
else {
if (PyErr_Occurred())
PyErr_Print();
fprintf(stderr, "Cannot find function \"%s\"\n", argv[2]);
}
Py_XDECREF(pFunc);
Py_DECREF(pModule);
}
else {
PyErr_Print();
fprintf(stderr, "Failed to load \"%s\"\n", argv[1]);
return 1;
}
Py_Finalize();
return 0;
}
2. class鎿嶄綔
鎶婁笅闈㈠姞鍏ュ埌test2.py涓幓銆傚畾涔変簡涓涓緢綆鍗曠殑綾伙紝鏈変竴涓猲ame鎴愬憳鍙橀噺錛屼竴涓猵rintName鎴愬憳鍑芥暟
class TestClass:
def __init__(self,name):
self.name = name
def printName(self):
print self.name
cpp鏂囦歡
#include <python.h>
int main()
{
Py_Initialize();
PyObject * pModule = NULL;
PyObject * pFunc = NULL;
PyObject * pArg = NULL;
PyObject * pClass = NULL;
PyObject * pObject = NULL;
pModule = PyImport_ImportModule("test2");
pClass = PyObject_GetAttrString(pModule, "TestClass");//寰楀埌閭d釜綾?br> pArg = PyTuple_New(1);
PyTuple_SetItem(pArg, 0, Py_BuildValue("s", "Jacky"));
pObject = PyEval_CallObject(pClass, pArg);//鐢熸垚涓涓璞★紝鎴栬呭彨浣滃疄渚?/p>
pFunc = PyObject_GetAttrString(pObject, "printName");//寰楀埌璇ュ疄渚嬬殑鎴愬憳鍑芥暟
PyEval_CallObject(pFunc, NULL);//鎵ц璇ュ疄渚嬬殑鎴愬憳鍑芥暟
Py_Finalize();
return 0;
}
娌℃湁浠涔堣祫鏂欙紝灝卞厛鍐欏埌榪欓噷浜嗐備笅闈粙緇嶄竴涓嬫庝箞build python25鐨勬簮浠g爜
3. 緙栬瘧python婧愪唬鐮?br>涓轟粈涔堣緙栬瘧鍛紵鍥犱負娌℃湁python25_d.lib錛佸懙鍛點傞『渚垮彲浠ヤ簡瑙d竴涓嬩唬鐮佺粨鏋勩?br>瑙e帇緙╁悗錛屾湁濂藉鐩綍錛屽叾涓璸cbuild鍜宲cbuild8鏄垜浠鐨勩俻cbuild瀵瑰簲鐫vc7.1鐨?pcbuild8瀵瑰簲鐫vc8.0鐨?br>鍥犱負鍦ㄧ敤vc7.1錛屼篃灝辨槸2003浜嗐傛墍浠ユ垜灝辮璇存庝箞鐢?003鏉ョ紪璇戝惂銆備簨瀹炰笂鏄粠涓浣嶇墰浜洪偅閲屽鏉ョ殑
http://blog.donews.com/lemur/archive/2005/12/17/660973.aspx錛岄偅浣嶅ぇ鍝ュぇ姒備竴騫村崐鍓嶅氨鍦ㄨВ鍓杙ython浜嗭紝鍘夊
闃褲傜湅鏉ユ垜鍙兘鍚庢潵灞呬笂浜嗭紝濞冨搱鍝堛傛垜鎸夌収浠栬鐨勮瘯浜嗕竴涓嬶紝緙栬瘧鎴愬姛錛?/p>
涓嶈繃閬囧埌涓鐐瑰皬闂錛岀敤vc2003鎵撳紑閭d釜solution鐨勬椂鍊欙紝鍙戠幇浣滆呮病鏈夋妸source code control鍘繪帀錛岄儊闂鳳紒瀹崇殑鎴?/p>
浠墦寮鐨勬椂鍊欎竴鍫唌essagebox銆備笉榪囦笉鐢ㄧ瀹冨氨濂戒簡錛屼竴鐩寸‘瀹氥傛渶鍚庤瘯浜嗕竴涓嬮偅涓猵ython25_d.lib錛屾病闂銆備笉榪囪
寰楁妸python25_d.dll copy鍒頒竴涓兘琚壘鍒扮殑鐩綍錛屾瘮濡傝c:\windows\system32\涓嬮潰銆俻ython25.dll涔熷湪榪欎釜鐩綍涓?/p>
闈€俹ver銆傛仼銆?/p>
python鏂囦歡
#Filename test2.py
def Hello(s):
print "Hello, world!"
print s
cpp鏂囦歡
#include <python.h>
int main()
{
Py_Initialize();
PyObject * pModule = NULL;
PyObject * pFunc = NULL;
PyObject * pArg = NULL;
pModule = PyImport_ImportModule("test2");
pFunc = PyObject_GetAttrString(pModule, "Hello");
pArg = Py_BuildValue("(s)", "function with argument");
PyEval_CallObject(pFunc, pArg);
Py_Finalize();
return 0;
}
娉ㄦ剰錛屽弬鏁拌浠uple鍏冪粍褰㈠紡浼犲叆銆傚洜涓鴻繖涓嚱鏁板彧瑕佷竴涓弬鏁幫紝鎵浠ユ垜浠洿鎺ヤ嬌鐢?s)鏋勯犱竴涓厓緇勪簡銆?/p>
2. 涓涓湁涓や釜鍙傛暟鐨勪緥瀛?/p>
python鏂囦歡涓姞鍏ヤ互涓嬩唬鐮侊紝涓涓姞鍑芥暟
def Add(a, b):
print "a+b=", a+b
cpp鏂囦歡錛屽彧鏀逛簡涓よ錛屾湁娉ㄩ噴鐨勯偅涓よ
#include <python.h>
int main()
{
Py_Initialize();
PyObject * pModule = NULL;
PyObject * pFunc = NULL;
PyObject * pArg = NULL;
pModule = PyImport_ImportModule("test2");
pFunc = PyObject_GetAttrString(pModule, "Add");//緇堜簬鍛婂埆hello world浜嗭紝寮濮嬩嬌鐢ㄦ柊鐨勫嚱鏁?br> pArg = Py_BuildValue("(i,i)", 10, 15);//鏋勯犱竴涓厓緇?/p>
PyEval_CallObject(pFunc, pArg);
Py_Finalize();
return 0;
}
鍏跺畠鐨勫氨綾諱技浜嗐傘傘傚熀鏈笂錛屾垜浠煡閬撲簡鎬庝箞鍦╟++涓嬌鐢╬ython涓殑鍑芥暟銆傛帴涓嬫潵瀛︿範涓涓嬪浣曚嬌鐢╬ython涓殑
class銆?/p>
闄勶細Py_BuildValue鐨勪嬌鐢ㄤ緥瀛愶紝鏉ヨ嚜python documentation錛?/p>
Py_BuildValue("") None
Py_BuildValue("i", 123) 123
Py_BuildValue("iii", 123, 456, 789) (123, 456, 789)
Py_BuildValue("s", "hello") 'hello'
Py_BuildValue("ss", "hello", "world") ('hello', 'world')
Py_BuildValue("s#", "hello", 4) 'hell'
Py_BuildValue("()") ()
Py_BuildValue("(i)", 123) (123,)
Py_BuildValue("(ii)", 123, 456) (123, 456)
Py_BuildValue("(i,i)", 123, 456) (123, 456)
Py_BuildValue("[i,i]", 123, 456) [123, 456]
Py_BuildValue("{s:i,s:i}",
"abc", 123, "def", 456) {'abc': 123, 'def': 456}
Py_BuildValue("((ii)(ii)) (ii)",
1, 2, 3, 4, 5, 6) (((1, 2), (3, 4)), (5, 6))
0. 鍧忓璁劇疆
鎶妏ython鐨刬nclude/libs鐩綍鍒嗗埆鍔犲埌vc鐨刬nclude/lib directories涓幓銆傚彟澶栵紝鐢變簬python娌℃湁鎻愪緵debug lib錛屼綋鍦拌錛屽氨鏄病鏈夋彁渚沺ython25_d.lib浜嗐備綘鍙互鑷繁緙栬瘧python鐨勬簮浠g爜鏉ュ緱鍒皃ython25_d.lib鐨勶紝鍋惰繕娌¤瘯榪囷紝鍛靛懙銆傝屼笖緗戜笂鎵句簡涓涓嬩篃娌′笅杞藉埌銆傛墍浠ワ紝濡傛灉浣犳兂瑕佸湪debug涓嬭繍琛岀▼搴忕殑璇濓紝浣犺鎶妏yconfig.h錛堝湪python25/include/鐩綍涓嬶級鐨勫ぇ姒傛槸鍦?83琛岋紝鎶妏ragma comment(lib,"python25_d.lib")鏀規垚pragma comment(lib,"python25.lib")錛岃python閮戒嬌鐢ㄩ潪debug lib.
1. 寮濮嬬紪紼嬩簡
#include <python.h>
絎竴姝ュ氨鏄寘鍚玴ython鐨勫ご鏂囦歡
2. 鐪嬩竴涓緢綆鍗曠殑渚嬪瓙
1)python鏂囦歡test.py錛屽緢綆鍗曠殑瀹氫箟浜嗕竴涓嚱鏁?/p>
#Filename test.py
def Hello():
print "Hello, world!"
榪欎釜搴旇鑳界湅鎳傜殑鍚э紵鍚﹀垯鐨勮瘽錛屽洖鍘誨啀緇冪粌python鍚э紝鍛靛懙銆傘婄畝鏄嶱ython鏁欑▼銆婼waroop, C. H. 钁椼傛矆媧佸厓 璇戙?/p>
2)cpp鏂囦歡
#include <python.h> //鍖呭惈澶存枃浠訛紝鍦╟++涓祵鍏ython錛岃繖鏄繀欏葷殑
int main()
{
Py_Initialize();
PyObject * pModule = NULL;
PyObject * pFunc = NULL;
pModule = PyImport_ImportModule("test");
pFunc = PyObject_GetAttrString(pModule, "Hello");
PyEval_CallObject(pFunc, NULL);
Py_Finalize();
return 0;
}
絎竴姝ヨ繕鏄寘鍚ご鏂囦歡
絎簩姝ワ紝浣跨敤python涔嬪墠錛岃璋冪敤Py_Initialize();榪欎釜鍑芥暟榪涜鍒濆鍖栥?br>甯姪鏂囨。涓鏄錛?br>The basic initialization function is Py_Initialize(). This initializes the table of loaded modules, and creates the fundamental modules __builtin__, __main__, sys, and exceptions. It also initializes the module search path (sys.path).
鍙嶆錛屼竴寮濮嬩綘涓瀹氳璋冪敤銆?/p>
絎笁姝ワ紝澹版槑涓浜汸ython鐨勫彉閲忥紝PyObject綾誨瀷鐨勩傚叾瀹炲0鏄庝篃鍙斁鍦ㄥ墠闈紝榪欎釜鍊掓槸鏃犳墍璋撶殑銆?/p>
絎洓姝ワ紝import module錛屼篃灝辨槸浣犵殑鑴氭湰鍚嶅瓧錛屼笉闇瑕佸姞鍚庣紑鍚嶏紝鍚﹀垯浼氬嚭閿欑殑銆?/p>
絎簲姝ワ紝浠庝綘import榪涙潵鐨刴odule涓緱鍒頒綘瑕佺殑鍑芥暟
pFunc = PyObject_GetAttrString(pModule, "Hello");
涓婇潰鐨勪緥瀛愬凡緇忓娓呮鐨勪簡錛屾渶鍚庝竴涓槸浣犺寰楀埌鐨勫嚱鏁扮殑鍚嶅瓧
絎叚姝ワ紝璋冪敤PyEval_CallObject鏉ユ墽琛屼綘鐨勫嚱鏁幫紝絎簩涓弬鏁頒負鎴戜滑瑕佽皟鐢ㄧ殑鍑芥暟鐨勫嚱鏁幫紝鏈緥瀛愪笉鍚弬鏁幫紝鎵浠ヨ緗負NULL銆?/p>
絎竷姝ワ紝璋冪敤Py_Finalize錛岃繖涓牴Py_Initialize鐩稿搴旂殑銆備竴涓湪鏈鍓嶉潰錛屼竴涓湪鏈鍚庨潰銆?/p>
絎竴嬈″啓鏁欑▼銆傝繖涓緥瀛愰潪甯哥畝鍗曪紝鏈漢涔熻繕鍦ㄥ涔犲綋涓樋錛屽彧鑳戒繚璇佸ぇ瀹惰兘澶熸妸榪欎釜渚嬪瓙榪愯璧鋒潵銆傚緩璁ぇ瀹跺幓鐪媝ython鐨刣ocumentaion錛岄噷闈㈡湁璁叉庝箞embedding python鐨勩傚厛鍐欏埌榪欓噷錛屽叾瀹炵洰鍓嶄篃鍙鍒拌繖涔堝錛屽懙鍛點備笅嬈″浜嗘洿澶氫互鍚庡啀鍐欍侽ver銆傛仼銆?/p>
The GetDC function retrieves a handle of a display device context (DC) for the client area of the specified window. The display device context can be used in subsequent GDI functions to draw in the client area of the window.
This function retrieves a common, class, or private device context depending on the class style specified for the specified window. For common device contexts, GetDC assigns default attributes to the device context each time it is retrieved. For class and private device contexts, GetDC leaves the previously assigned attributes unchanged.
HDC GetDC(
HWND hWnd // handle of window
);
Parameters
hWnd
Identifies the window whose device context is to be retrieved.
GetWindowDC
The GetWindowDC function retrieves the device context (DC) for the entire window, including title bar, menus, and scroll bars. A window device context permits painting anywhere in a window, because the origin of the device context is the upper-left corner of the window instead of the client area.
GetWindowDC assigns default attributes to the window device context each time it retrieves the device context. Previous attributes are lost.
HDC GetWindowDC(
HWND hWnd // handle of window
);
Parameters
hWnd
Identifies the window with a device context that is to be retrieved.
棣栧厛錛屽緢瀹規槗鎯沖埌鐨勫氨鏄紝姹?/span>0鐨勪釜鏁幫紝灝辨槸姹?/span>5鐨勪釜鏁幫紙濡傛灉榪欎釜浣犻兘鎯充笉鏄庣櫧鐨勮瘽錛岄偅灝便傘傘傚啀濂藉ソ鎯蟲兂鍚э紝鍛靛懙錛夛紱
鎺ヤ笅鏉ワ紝濡備綍姹?/span>5鐨勪釜鏁板憿錛熷鏋滈亶鍘嗕竴閬嶇殑璇濓紝閭f樉鐒舵槸澶參浜嗭紒鍥犱負榪欑璁$畻棰樺お鏈夎寰嬩簡錛佹兂浜嗗ソ涔咃紝緇堜簬鎯沖嚭鏉ヤ簡錛?/span>
Result = 0; // 鏈鍚庣殑緇撴灉
while ( N >= 5 )
{
N /= 5;
Result += N;
}
// 緇撴潫浜嗐?/span>
娌¢敊錛屽氨鏄繖涔堢畝鍗曪紒涓嬮潰綆鍗曡璇翠負浠涔堣繖鏍峰瓙鍋氭槸瀵圭殑錛堝伓灝忚瘯浜嗕竴涓嬶紝娌¢棶棰橈紝鍛靛懙錛夛細
絎竴嬈¢櫎浠?/span>5琛ㄧず5鐨勫嶆暟鐨勪釜鏁幫紝
絎簩嬈¢櫎浠?/span>5琛ㄧず5鐨勫鉤鏂圭殑鍊嶆暟鐨勪釜鏁幫紝錛堟樉鐒訛紝5鐨勫鉤鏂規殫鍚簡涓や釜0錛?/span>
銆傘傘備緷姝ょ被鎺?/span>
鏈鍚庡綋N<5浜嗭紝緇撴潫銆?/span>
灝忓皬鐨勯獙璇佷竴涓嬶細
26錛?/span>
26/5 = 5錛?/span> 5/5 = 1錛岄偅涔堟渶鍚?/span>0鐨勪釜鏁板氨鏄?/span>6浜嗐傜敤Google綆椾簡涓涓嬶紝緇撴灉G澶у彅鐩存帴鐢ㄦ湁鏁堟暟瀛楄〃紺轟簡錛?/span>@$%$%@$%銆傘傘備笉榪囧簲璇ユ槸娌¢敊浜嗐傛仼銆?/span>
Sigh錛岀煡閬撶粨鏋滃悗鎵嶇煡閬撳師鏉ヨ繖涔堢畝鍗曠殑闃匡紝鍋跺湡浜嗐?/span>
The same thing happens in life. We set goals and make plans - and sometimes discover that we're on "the wrong train."
Bi-vinat ha-lave literally means "understanding the heart." The heart is the seat of emotions. We say: "My heart is heavy, my heart is lifted, my heart is broken," etc. To understand your heart is to understand your true inner self.
Many people go through life making assumptions about who they are. They never take time to "meet" themselves. Don't be afraid of discovering that the "real you" may be different than the "current you."
Often a crisis hits at midlife when people ask: "What's my life about? Is this all worth it?" We've heard stories of people who suddenly change direction, quitting their job and getting divorced. You know, like the successful doctor who decides he never wanted to go into medicine in the first place -- so he drops it and becomes an artist.
Knowing yourself is the essence of being alive. If you don't know yourself, you are not living. If you don't know what makes you tick, you're a robot, a puppet, a zombie.
So don't wait for a crisis. Life is too short to take wrong trains.
GETTING STARTED
Think of someone you'd be fascinated to meet, someone you'd really like to find out what makes him tick.
Now realize the most fascinating person you could ever meet is ... yourself.
Sit down, say hello, and introduce yourself to yourself. Become familiar with yourself as if you'd just met a long-lost cousin. Interview yourself. Ask questions about your life and the direction you're going. Search out your dreams -- both the ones you're fulfilling and the ones you've pushed to the back of your mind.
Get down to basics. You want to be rich. You want to be famous. You want to be good. You want to accomplish. You want meaning. You want to be creative. But why do you want all this? What's driving you? What you really want out of life?
The process of self-discovery involves asking a series of questions, always probing deeper until the underlying truth emerges. Ask yourself 10 questions that you would ask an intimate friend. Then wait for answers. Don't worry, no one is going to poke fun at you.
Don't be surprised if the answers aren't immediate. This process can take many months. Stick with it and find out what makes you tick. The answers are hiding in there. After all, you have a fascinating partner.
Finally, the most important question to ask is:
"What am I living for?"
It sounds like a simple question, but many are embarrassed to ask it. A voice inside us says, "Nah, why ask such a basic question?" We're resistant because we know this requires a lot of difficult soul-searching. And when you thoroughly know yourself, then you have changed. You've changed your relationship with yourself and the world.
CONFIDENCE IN DECISION-MAKING
People often avoid making decisions out of fear of making a mistake.
Actually, the failure to make decisions is one of life's biggest mistakes.
Imagine the beggar who receives a letter saying that he's inherited a million dollars. If he doesn't read the letter, is he rich ... or not?
Similarly, God gave us the free will to make choices in life and achieve greatness. But if we're not aware of our free will, then we don't really have it. And then we wind up blaming others when things go wrong -- even though we know the decision is really up to us.
If you're not using your potential, it wears away at your confidence. Do you know what your potential is? Have you tried to use it? You have to tackle life. You haven't given up yet, have you? Let's get on with the game, with the business of really living, of not just "going through the motions."
Know the difference between "making decisions" and just floating, falling into place. Did you choose to go to college? Or perhaps you had nothing to do with the decision. Was it something you just did because you graduated high school and everybody else was doing it? Did you think it through and actually make a decision?
Imagine this private conversation of a college student:
Why am I going to college?
To get a degree.
Why?
Because I want to get into a good graduate school.
Why?
So I'll get a good job.
Why?
So I can pay back my college loans!
Through the process of questioning, he reveals a logical fault in his motivation. Really, the primary reason for going to college should be to acquire wisdom, knowledge and information. In other words, to get an education!
Now try the process yourself, using this example:
Why do I want to get married?
Don't accept pat answers. Keep asking "Why, why why?" Be frank. It's yourself. Ask any question you like. Be patient and persistent. Eventually you'll get an answer.
When you thoroughly analyze an issue, then you can make wise decisions with confidence.
Identify where you lack confidence. What makes you nervous? What situations inhibit you from being yourself? Why can't you make decisions? Is it that you don't know how to make decisions? Or that you doubt your decisions after they're made? Or you just don't feel like making decisions?
Enjoy making decisions. Deal with the world you live in. That's loving the dynamics of life.
ISOLATE YOUR BLOCKS
Anytime you find it difficult to achieve a goal, figure out what's holding you back.
Everyone has problems. Being aware of these problems is the key to getting in touch with yourself. Because as long as you don't face problems, they fester and bug you from behind.
Write your "blocks" on a piece of paper. That's a good step in the right direction. By isolating specific obstacles, you turn them into concrete challenges that require solutions.
Ask yourself:
Negative character traits are the roots of our problems. Make a list of your negative traits, and identify when they affect you the most. Then analyze what triggers these reactions in you. Finally, formulate an effective counter-approach.
Working through this takes time. But do you have anything better to be doing right now?
READ YOUR EMOTIONS
Get in touch with your emotional state. Take a reading of how you feel. Happy? Angry? Tense? Sad? Emotions are a measuring stick for what's going on below the surface. It's like taking your temperature. If you're sick, you need to be aware so you can fix the problem.
Find out why you're upset. Who or what is pressuring you? Is it an internal or an external problem? Identify it.
Let's say you are irritated. Why?
Because the boss chewed me out.
So why am I irritated?
Because I resent him.
So what? Why does that bother me?
Because I feel I am no good.
I'm no good? He's nuts!
Get out of yourself and track it down. If you don't, it's just irritation. And the next thing you know, you'll go home and yell at your kids.
Once you've identified what causes negative feelings, adjust yourself to minimize the impact. Either avoid these situations, or prepare yourself to handle them when they arise.
Further, root out negative motivations that corrupt your behavior. Let's say that you give charity. Why? One motivation is to help humanity. Another is the pleasure of being constructive. A third is the desire to do the right thing. These are all positive motivations. A negative motivation for giving charity is: "I want people to admire me." That's corruptive.
The next time you give charity, do so anonymously. Eliminate the wrong reasons. They are destructive.
The same goes with the positive emotions. Be aware of how your emotional state affects decisions. For example, don't buy a new stereo when you're in a euphoric mood. Wait. Think it over. You are susceptible.
Pinpoint what makes you happy. You can have more joy on a daily basis by formulating some practical applications. You got up in the morning, it's a gorgeous day and you feet great. You're energized. Now take that feeling and teach yourself how to get up on the right side -- every day!
Another example: You did a good job and got the boss's compliment. Now focus: Do you need the boss to tell you did a good job? No! Create your own pleasure out of doing a good job.
GET IN TOUCH WITH YOUR TWO SIDES
Everyone has an urge for greatness. We want self respect, power, fame. We want to accomplish, to be strong, to do the right thing, to even save the world.
Yet at the same time, we have a counter-urge to run away from responsibility, to get into bed and crawl under the covers.
Someone may say, "Life is beautiful," but he doesn't feel it. His emotions hold him back and he walks around going, "Ugh, life is a burden."
Recognize the volcano of conflict within you: What you truly "want," versus what you "feel" like. This is the conflict between body and soul.
Once you appreciate the dichotomy, you can identify at any moment whether your body or soul is talking. This makes it possible to live with sanity and choose the right thing.
The next step is to make peace between your two sides. The easiest way is to squash your drive to be great. But life is not about taking the easy way out. Just because you feel uncomfortable about an idea doesn't mean it's wrong for you. It's hard to break habits, and growth can be frightening.
For example, would you rather be happy or rich? Okay, you'd rather be happy. Now imagine this exchange:
"Come on, I'll teach you how to be happy. All it requires is effort and change."
"Oh, I'd love to, but I can't right now. It's impossible. I've got a flight to catch."
"Really? I'll pay you $10,000 a week to work on happiness."
"Sure! Where do I sign up?"
"Oh, but I thought you can't right now..."
We conceal our problems with rationalization: "I'll wreck my mind thinking about what life is about! Nobody really knows what life is about. It's not going to work. Nothing can be done about it anyway. I don't really care. It's not worth the time!"
The Sages say that a person only makes a mistake when overcome by a moment of insanity. So realize that you are fighting "insanity." It is not logical. You've got to be on guard. Because if you get off track, you'll pay for it down the road.
So ... do you want to change? What have you got against it? Feel the antipathy of the body. We are so darn lazy. The body just wants to sleep. "Aaaah ... I don't want to change. I'm happy enough. I'm comfortable in my niche of misery." Are you rich enough? No! So are you happy enough?
You see the importance of tracking that down? You have to identify the animal you are fighting. "The dread of change."
If you're alert, you see the enemy. You can fight it. You may lose a struggle with the body, but at least you have your confidence. "I know what I am doing."
COAX THE BODY
Get in touch with your spiritual core. Know what is driving you. Don't let free will be a subconscious thing. You want greatness. But the body says that's too much effort.
To try to convince the body, try to identify the tangible benefit. "Why is it necessary? What will it do for me?" You have to bring it home to emotional realization. "What do I lose?" What do I gain?" Only then will the idea have power. And you'll get out there and do it.
Here's the secret formula: Identify with your intellect, and coax your heart along. For example, if you're emotionally convinced of the benefit of getting into shape, then even when you break out in a cold sweat and your heart is doing palpitations, you will keep going. Because you have decided, "I want this," you know it is important.
To avoid negative backlash, your emotions have to feel comfortable with the changes you make. Learn to relax and reassure the body. Cajole the body and say, "It won't be so bad. Remember the last time you made an effort, how great you felt!" Be encouraging and reward yourself for success.
Don't say it doesn't work. You haven't made the effort. Don't give up on your intuition and perception. Just realize you haven't yet brought it home to actualization.
Consider how the basic human drives affect you: security, self-respect, honor, passions, social pressure, and possessions. Pay particularly close attention to how you accept responsibility. Let's say that you made a mistake. You want to apologize in a full and forthright manner. Yet you feel like forgetting the whole thing, hiding, running away and saying "it's not my fault."
This is the volcano. We want to be tough, dedicated and powerful -- yet we feel like being marshmallows. Choosing the path of the soul doesn't come naturally. It takes a lot of time and hard work.
KNOW WHAT YOU KNOW
Don't think that just because you understand something, you are living with it. It is possible to believe one way, and yet act another. It happens to us all the time. You can believe it's important to eat healthy food, yet gorge yourself on French fries and chocolate cake.
Our actions are determined by our level of clarity. If we understand an idea on just a superficial level, then we'll have difficulty sticking to it when the going gets tough.
Next time you go to a funeral, watch carefully. When they remove the body from the chapel, the mourners start to cry. Are they crying because they want to body to stay there?! No. All of a sudden there is a realization of death, that he won't be coming back. At the cemetery, they lower the casket into the ground and the mourners cry again. It's the emotional realization that death is final now.
Until you align your feelings with reality, you are in dreamland. Growth begins in the mind, but your heart has to buy into everything your mind discovers. Only then will you integrate these ideas into day-to-day life.
A lot of people believe in God. There are very few people who live with God. Does that make sense? You have to assimilate something that you've accepted as true. It has to become part of you.
FIVE-FINGER CLARITY
You've got to know yourself cold, just like you know your hand has five fingers. How do you know you are on the right path? How do you know you're not making a mistake right now?
To develop this clarity, articulate the important principles that guide your life. For example, in Judaism we say that love is an obligation. Is this reasonable? Work the issue through with yourself:
"Ridiculous. You can't obligate me to love."
"But if I have children, will I love them?"
"Of course I'm going to love my kids!"
"How do I know? I don't know what kind of kids I'm going to have. Maybe they'll be brats and I won't love them."
"I will. I'm obligated to love my children."
Do you see the contradiction? On an intuitive level, you know that love is an obligation. But the concept is not so clear that you can articulate it.
Take your time. Sort out the basic aspects of living. Ask yourself important questions about life's global and spiritual issues.
--?What is the meaning of existence?
--?What's good about living?
--?How do I feel about humanity?
--?What is the afterlife?
--?How do I understand good versus evil?
--?Do I have free will? How do I activate it?
--?What makes me sad? Is it okay to be sad?
--?How do I feel about God?
--?Am I proud to be a Jew?
--?How do I understand the Holocaust?
Some of these topics may be unpleasant to think about. If so, why is it unpleasant? Track it down.
Don't just use slogans to parrot things that you heard. Know why you are doing what you are doing. Otherwise, it's just society talking. You may have adopted part of society without analyzing its validity. Check it out.
Work through all the issues until you have "five-finger clarity." A human being who knows what he wants will get there. By hook or by crook. It's like a homing mechanism on a missile. If you program it right, you will get there.
WHY IS "KNOWING YOURSELF" AN INGREDIENT IN WISDOM?
浠ュ線錛屾垜浠墍浣跨敤鐨勮璦錛屾瘮濡?/span>C錛?/span>C++絳夌瓑錛岄兘縐頒負闈欐佽璦銆備粈涔堟槸闈欐佽璦鍛紵灝辨槸璇達紝鍦ㄤ嬌鐢ㄦ暟鎹箣鍓嶏紝鎴戜滑蹇呴』棣栧厛瀹氫箟鏁版嵁綾誨瀷錛岃繖浜涙暟鎹被鍨嬪寘鎷?/span>int, float, double絳夌瓑銆傚氨鐩稿綋浜庡湪浣跨敤瀹冧滑涔嬪墠錛岄鍏堣涓哄畠浠垎閰嶅ソ鍐呭瓨絀洪棿錛涜屽姩鎬佽璦灝卞垰鍒氭槸鐩稿弽鐨勶紝瀹冩槸鍦ㄥ緱鍒版暟鎹被鍨嬩箣鍚庯紝鍐嶄負瀹冨垎閰嶅唴瀛樼┖闂淬?/span>
“鑴氭湰璇█闄や簡鎺ヨ繎鍙h鍖栫殑璁捐澶栵紝鍙﹀姞涓婄畝鍖栧悗鐨勮娉曘傦紙闄や簡鍐呭緩鐨勫懡浠ゅ錛岄氬父浠呴渶綆鍗曠殑閫昏緫鍒ゆ柇涓庢暟鍊艱綆楀嵆鍙儨浠伙級鍥犳鐢ㄨ剼鏈璦鍒朵綔娓告垙錛屼笉鍐嶆槸闈炵▼搴忓憳涓嶅彲鐨勫伐浣滐紙闄や簡緋葷粺鏈韓鐨勪慨璁級錛屼紒鐢諱漢鍛樹篃鍙互寰堝揩鍦拌繘鍏ョ姸鎬併傚彟澶栵紝濡傛灉灝嗘潵闇瑕佸皢娓告垙縐繪鍒板叾浠栧鉤鍙版椂錛屾瘮璧風▼搴忎笌璧勬枡鐨勭洏鏍歸敊鑺傜殑璁捐錛屽埄鐢ㄨ剼鏈璦鏉ュ紑鍙戠殑娓告垙錛屽彧闇瑕佷慨鏀圭郴緇熸湰韜紝鑴氭湰璇█閮ㄥ垎鏈韓姣嬮』鏇村姩錛岀浉褰箣涓嬪嚭鐜伴棶棰樼殑鏈轟細涓庤寖鍥村氨緙╁皬浜嗗緢澶氥?/span>
鍋跺張璇曚簡涓嬈★紝鍙戠幇lines number鍙兘鏄湁闂鐨勶紝鑰屼笖涔熶笉鏄垜鐨勯偅縐嶇畻娉曘備笉榪囧嚱鏁板悕鑲畾鏄鐨?br>
鍦╲ckbase涓張鍙戠幇涓綃囧ソ鏂囷紝鎵浠ュ氨鍙堣創榪囨潵浜嗐備笉榪囧彲鎯滅殑鏄紝榪樻槸娌¤兘瑙e喅dll鐨勫湴鍧鏄犲皠闂錛屾棤娉晅rack鍒癲ll鍐呯殑淇℃伅錛屽彲鎯滀簡銆?br>
瀵?#8220;浠呴氳繃宕╂簝鍦板潃鎵懼嚭婧愪唬鐮佺殑鍑洪敊琛?#8221;涓鏂囩殑琛ュ厖涓庢敼榪?/strong>
浣滆咃細涓婃搗浼熷姛閫氫俊 roc
涓嬭澆婧愪唬鐮?/font>
銆銆璇諱簡鑰佺綏鐨?#8220;浠呴氳繃宕╂簝鍦板潃鎵懼嚭婧愪唬鐮佺殑鍑洪敊琛?/font>”(涓嬬О"緗楁枃")涓鏂囧悗錛屾劅瑙夎鏂囪繕鏄彲浠ュ鍒頒笉灝戜笢瑗跨殑銆備笉榪囨枃涓皻瀛樺湪鏈変簺璇存硶涓嶅Ε錛屼互鍙婃湁浜涙搷浣滃お綣佺悙鐨勫湴鏂?銆備負姝わ紝鏈漢鍦ㄥ涔犱簡姝ゆ枃鍚庯紝鍦ㄥ嬈″疄楠屽疄璺靛熀紜涓婏紝鎶婅鏂囦腑鐨勪竴浜涘唴瀹硅繘琛岃ˉ鍏呬笌鏀硅繘錛屽笇鏈涘澶у璋冭瘯紼嬪簭錛屽挨鍏舵槸release鐗堟湰鐨勭▼搴忔湁甯姪 銆傛榪庡悇浣嶆湅鍙嬫壒璇勬寚姝c?br>
涓銆佽鏂規硶閫傜敤鐨勮寖鍥?/strong>
銆銆鍦╳indows紼嬪簭涓犳垚紼嬪簭宕╂簝鐨勫師鍥犲緢澶氾紝鑰屾枃涓墍榪扮殑鏂規硶浠呴傜敤涓?鐢變竴鏉¤鍙ュ綋鍗沖紩璧風殑紼嬪簭宕╂簝銆傚鍘熸枃涓婦鐨勯櫎鏁頒負闆剁殑宕╂簝渚嬪瓙銆傝岀瑪鑰呭湪瀹為檯宸ヤ綔涓鍒版洿澶氱殑鎯呭喌鏄?鎸囬拡鎸囧悜涓闈炴硶鍦板潃 錛岀劧鍚庡鎸囬拡鐨勫唴瀹硅繘琛屼簡錛岃鎴栧啓鐨勬搷浣溿備緥濡傦細
void Crash1() { char * p =(char*)100; *p=100; }
銆銆榪欎簺鍘熷洜閫犳垚鐨勫穿婧冿紝鏃犺鏄痙ebug鐗堟湰錛岃繕鏄痳elease鐗堟湰鐨勭▼搴忥紝浣跨敤璇ユ柟娉曢兘鍙壘鍒伴犳垚宕╂簝鐨勫嚱鏁版垨瀛愮▼搴忎腑鐨勮鍙ヨ錛屽叿浣撴柟娉曠殑涓嬮潰榪樹細琛ュ厖璇存槑銆?鍙﹀錛屽疄璺典腑鍙︿竴縐嶅父瑙佺殑閫犳垚紼嬪簭宕╂簝鐨勫師鍥?鍑芥暟鎴栧瓙紼嬪簭涓眬閮ㄥ彉閲忔暟緇勮秺鐣屼粯鍊鹼紝閫犳垚鍑芥暟鎴栧瓙紼嬪簭榪斿洖鍦板潃閬鐩栵紝浠庤岄犳垚鍑芥暟鎴栧瓙紼嬪簭榪斿洖鏃跺穿婧冦備緥濡?
#includevoid Crash2(); int main(int argc,char* argv[]) { Crash2(); return 0; } void Crash2() { char p[1]; strcpy(p,"0123456789"); }
鍦╲c涓紪璇戣繍琛屾紼嬪簭鐨剅elease鐗堟湰錛屼細璺沖嚭濡備笅鐨勫嚭閿欐彁紺烘銆?
鍥句竴 涓婇潰渚嬪瓙榪愯緇撴灉
銆銆榪欓噷鏄劇ず鐨勫穿婧冨湴鍧涓?0x34333231銆傝繖縐嶇敱鍓嶉潰璇彞閫犳垚鐨勫穿婧冩牴婧愶紝鍦ㄥ悗緇▼搴忎腑鏂規墠鏄劇幇鍑烘潵鐨勬儏鍐碉紝鏄劇劧鐢ㄨ鏂囨墍榪扮殑鏂規硶灝辨棤鑳戒負鍔涗簡銆備笉榪囧湪姝や緥涓灝戣繕鏈変簺铔涗笣椹抗鍙鎵懼埌宕╂簝鐨勫師鍥?鍑芥暟Crash2涓殑灞閮ㄦ暟緇刾鍙湁涓涓瓧鑺傚ぇ灝?錛屾樉鐒舵嫹璐?0123456789"榪欎釜瀛楃涓蹭細鎶婅秴鍑洪暱搴︾殑瀛楃涓叉嫹璐濆埌鏁扮粍p鐨勫悗闈紝鍗?(p+1)=''1''錛?(p+2)=''2''錛?(p+3)=''3''錛?(p+4)=4銆傘傘傘傘傘傝屽瓧絎?'1''鐨凙SC鐮佺殑鍊間負0x31錛?'2''涓?x32錛?'3''涓?x33錛?'4''涓?x34銆傘傘傘傘傦紝鐢變簬intel鐨刢pu涓璱nt鍨嬫暟鎹槸浣庡瓧鑺備繚瀛樺湪浣庡湴鍧涓?錛屾墍浠ヤ繚瀛樺瓧絎︿覆''1234''鐨勫唴瀛橈紝鏄劇ず涓轟竴涓?瀛楄妭鐨刬nt鍨嬫暟鏃跺氨鏄?x34333231銆傛樉鐒舵嫹璐?0123456789"榪欎釜瀛楃涓叉椂錛?1234"榪欏嚑涓瓧絎︽妸鍑芥暟Crash2鐨勮繑鍥炲湴鍧緇欒鐩?錛屼粠鑰岄犳垚紼嬪簭宕╂簝銆傚浜庣被浼肩殑榪欑閫犳垚紼嬪簭宕╂簝鐨勯敊璇湅鍙嬩滑榪樻湁鍏朵粬鏂規硶鎺掗敊鐨勮瘽錛屾榪庝竴璧蜂氦嫻佽璁恒?br>
浜屻佽緗紪璇戜駭鐢焟ap鏂囦歡鐨勬柟娉?/strong>
銆銆璇ユ枃涓駭鐢焟ap鏂囦歡鐨勬柟娉曟槸鎵嬪伐娣誨姞緙栬瘧鍙傛暟鏉ヤ駭鐢焟ap鏂囦歡銆傚叾瀹炲湪vc6鐨処DE涓湁浜х敓map鏂囦歡鐨勯厤緗夐」鐨勩傛搷浣滃涓?鍏堢偣鍑昏彍鍗?Project"->"Settings銆傘傘?錛屽脊鍑虹殑灞炴ч〉涓変腑"Link"欏?錛岀‘淇濆湪"category"涓変腑"General"錛屾渶鍚庨変腑"Generate mapfile"鐨勫彲閫夐」銆傝嫢瑕佸湪鍦╩ap鏂囦歡涓樉紺篖ine numbers鐨勪俊鎭殑璇?錛岃繕闇鍦╬roject options 涓姞鍏?mapinfo:lines 銆侺ine numbers淇℃伅瀵逛簬"緗楁枃"鎵鐢ㄧ殑鏂規硶鏉ュ畾浣嶅嚭閿欐簮浠g爜琛屽緢閲嶈 錛屼絾絎旇呭悗闈細浠嬬粛鏇村姞濂界殑鏂規硶鏉ュ畾浣嶅嚭閿欎唬鐮佽錛岄偅縐嶆柟娉曚笉闇瑕丩ine numbers淇℃伅銆?
鍥句簩 璁劇疆浜х敓MAP鏂囦歡
涓夈佸畾浣嶅穿婧冭鍙ヤ綅緗殑鏂規硶
銆銆"緗楁枃"鎵榪扮殑瀹氫綅鏂規硶涓紝鎵懼埌浜х敓宕╂簝鐨勫嚱鏁頒綅緗殑鏂規硶鏄紜殑錛屽嵆鍦╩ap鏂囦歡鍒楀嚭鐨勬瘡涓嚱鏁扮殑璧峰鍦板潃涓紝鏈榪戠殑涓斾笉澶т簬宕╂簝鍦板潃鐨勫湴鍧鍗充負鍖呭惈宕╂簝璇彞鐨勫嚱鏁扮殑鍦板潃 銆備絾涔嬪悗鐨勫啀榪涗竴姝ョ殑瀹氫綅鍑洪敊璇彞琛岀殑鏂規硶涓嶆槸鏈濡ュ綋錛屽洜涓洪偅縐嶆柟娉曞墠鎻愭槸錛屽亣璁懼熀鍦板潃鐨勫兼槸 0x00400000 錛屼互鍙婁竴鑸殑 PE 鏂囦歡鐨勪唬鐮佹閮芥槸浠?0x1000鍋忕Щ寮濮嬬殑 銆傝櫧鐒惰繖縐嶆儏鍐靛緢鏅亶錛屼絾鍦╲c涓繕鏄彲浠ュ熀鍦板潃璁劇疆涓哄叾浠栨暟錛屾瘮濡傝緗負0x00500000錛岃繖鏃朵粛鏃у鐢?br>
宕╂簝琛屽亸縐?= 宕╂簝鍦板潃 - 0x00400000 - 0x1000
鐨勫叕寮忔樉鐒舵棤娉曟壘鍒板穿婧冭鍋忕Щ銆?鍏跺疄涓婅堪鍏紡鑻ユ敼涓?br>
宕╂簝琛屽亸縐?= 宕╂簝鍦板潃 - 宕╂簝鍑芥暟緇濆鍦板潃 + 鍑芥暟鐩稿鍋忕Щ
鍗沖彲閫氱敤浜嗐備粛浠?緗楁枃"涓殑渚嬪瓙涓轟緥:"緗楁枃"涓彁鍒扮殑鍦ㄥ叾宕╂簝紼嬪簭鐨勫搴攎ap鏂囦歡涓紝宕╂簝鍑芥暟鐨勭紪璇戠粨鏋滀負
0001:00000020 ?Crash@@YAXXZ 00401020 f CrashDemo銆俹bj
瀵逛笌涓婅堪緇撴灉錛屽湪浣跨敤鎴戠殑鍏紡鏃?錛?宕╂簝鍑芥暟緇濆鍦板潃"鎸?0401020錛?鍑芥暟鐩稿鍋忕Щ鎸?00000020錛?褰撳穿婧冨湴鍧= 0x0040104a鏃訛紝 鍒?宕╂簝琛屽亸縐?= 宕╂簝鍦板潃 - 宕╂簝鍑芥暟璧峰鍦板潃+ 鍑芥暟鐩稿鍋忕Щ = 0x0040104a - 0x00401020 + 0x00000020= 0x4a錛岀粨鏋滀笌"緗楁枃"璁$畻緇撴灉鐩稿悓 銆備絾榪欎釜鍏紡鏇撮氱敤銆?br>
鍥涖佹洿濂界殑瀹氫綅宕╂簝璇彞浣嶇疆鐨勬柟娉曘?/strong>
銆銆鍏跺疄闄や簡渚濋潬map鏂囦歡涓殑Line numbers淇℃伅鏈緇堝畾浣嶅嚭閿欒鍙ヨ澶栵紝鍦╲c6涓垜浠繕鍙互閫氳繃緙栬瘧紼嬪簭浜х敓鐨勫搴旂殑姹囩紪璇彞錛屼簩榪涘埗鐮侊紝浠ュ強瀵瑰簲c/c++璇彞涓轟竴浣撶殑"cod"鏂囦歡鏉ュ畾浣嶅嚭閿欒鍙ヨ 銆傚厛浠嬬粛涓涓嬩駭鐢熻繖縐嶅寘鍚簡涓夌淇℃伅鐨?cod"鏂囦歡鐨勮緗柟娉?鍏堢偣鍑昏彍鍗?Project"->"Settings銆傘傘?錛屽脊鍑虹殑灞炴ч〉涓変腑"C/C++"欏?錛岀劧鍚庡湪"Category"涓夊垯"Listing Files"錛屽啀鍦?Listing file type"鐨勭粍鍚堟涓夋嫨"Assembly錛孧achine code錛?and source"銆傛帴涓嬪幓鍐嶉氳繃涓涓叿浣撶殑渚嬪瓙鏉ヨ鏄庤繖縐嶆柟娉曠殑鍏蜂綋鎿嶄綔銆?
鍥句笁 璁劇疆浜х敓"cod"鏂囦歡
鍑嗗姝ラ1)浜х敓宕╂簝鐨勭▼搴忓涓?
01 //**************************************************************** 02 //鏂囦歡鍚嶇О錛歝rash銆俢pp 03 //浣滅敤: 婕旂ず閫氳繃宕╂簝鍦板潃鎵懼嚭婧愪唬鐮佺殑鍑洪敊琛屾柊鏂規硶 04 //浣滆咃細 浼熷姛閫氫俊 roc 05 //鏃ユ湡錛? 2005-5-16 06//**************************************************************** 07 void Crash1(); 08 int main(int argc,char* argv[]) 09 { 10 Crash1(); 11 return 0; 12 } 13 14 void Crash1() 15 { 16 char * p =(char*)100; 17 *p=100; 18 }
鍑嗗姝ラ2)鎸夋湰鏂囨墍榪拌緗駭鐢焟ap鏂囦歡(涓嶉渶瑕佷駭鐢烲ine numbers淇℃伅)銆?br>鍑嗗姝ラ3)鎸夋湰鏂囨墍榪拌緗駭鐢焎od鏂囦歡銆?br>鍑嗗姝ラ4)緙栬瘧銆傝繖閲屼互debug鐗堟湰涓轟緥(鑻ユ槸release鐗堟湰闇瑕佸皢緙栬瘧閫夐」鏀逛負涓嶈繘琛屼換浣曚紭鍖栫殑閫夐」錛屽惁鍒欎笂榪頒唬鐮佷細鍥犱負浼樺寲鏃剁湅浣滃簾浠g爜鑰屼笉琚紪璇戯紝浠庤岀湅涓嶅埌宕╂簝鐨勭粨鏋?錛岀紪璇戝悗浜х敓涓涓?exe"鏂囦歡 錛屼竴涓?map"鏂囦歡錛屼竴涓?cod"鏂囦歡銆?
榪愯姝ょ▼搴忥紝浜х敓濡備笅濡備笅宕╂簝鎻愮ず:
鍥懼洓 涓婇潰渚嬪瓙榪愯緇撴灉
鎺掗敊姝ラ1)瀹氫綅宕╂簝鍑芥暟銆傚彲浠ユ煡璇ap鏂囦歡鑾峰緱銆傛垜鐨勬満鍣ㄧ紪璇戜駭鐢熺殑map鏂囦歡鐨勯儴鍒嗗涓?
Crash Timestamp is 42881a01 (Mon May 16 11:56:49 2005) Preferred load address is 00400000 Start Length Name Class 0001:00000000 0000ddf1H .text CODE 0001:0000ddf1 0001000fH .textbss CODE 0002:00000000 00001346H .rdata DATA 0002:00001346 00000000H .edata DATA 0003:00000000 00000104H .CRT$XCA DATA 0003:00000104 00000104H .CRT$XCZ DATA 0003:00000208 00000104H .CRT$XIA DATA 0003:0000030c 00000109H .CRT$XIC DATA 0003:00000418 00000104H .CRT$XIZ DATA 0003:0000051c 00000104H .CRT$XPA DATA 0003:00000620 00000104H .CRT$XPX DATA 0003:00000724 00000104H .CRT$XPZ DATA 0003:00000828 00000104H .CRT$XTA DATA 0003:0000092c 00000104H .CRT$XTZ DATA 0003:00000a30 00000b93H .data DATA 0003:000015c4 00001974H .bss DATA 0004:00000000 00000014H .idata$2 DATA 0004:00000014 00000014H .idata$3 DATA 0004:00000028 00000110H .idata$4 DATA 0004:00000138 00000110H .idata$5 DATA 0004:00000248 000004afH .idata$6 DATA Address Publics by Value Rva+Base Lib:Object 0001:00000020 _main 00401020 f Crash.obj 0001:00000060 ?Crash1@@YAXXZ 00401060 f Crash.obj 0001:000000a0 __chkesp 004010a0 f LIBCD:chkesp.obj 0001:000000e0 _mainCRTStartup 004010e0 f LIBCD:crt0.obj 0001:00000210 __amsg_exit 00401210 f LIBCD:crt0.obj 0001:00000270 __CrtDbgBreak 00401270 f LIBCD:dbgrpt.obj ...
瀵逛簬宕╂簝鍦板潃0x00401082鑰岃█錛屽皬浜庢鍦板潃涓渶鎺ヨ繎鐨勫湴鍧(Rva+Base涓殑鍦板潃)涓?0401060錛屽叾瀵瑰簲鐨勫嚱鏁板悕涓?Crash1@@YAXXZ錛岀敱浜庢墍鏈変互闂彿寮澶寸殑鍑芥暟鍚嶇О閮芥槸 C++ 淇グ鐨勫悕縐?錛?@@YAXXZ"鍒欎負鍖哄埆閲嶈澆鍑芥暟鑰屽姞鐨勫悗緙錛屾墍浠?Crash1@@YAXXZ灝辨槸鎴戜滑鐨勬簮紼嬪簭涓紝Crash1() 榪欎釜鍑芥暟銆?br>鎺掗敊姝ラ2)瀹氫綅鍑洪敊琛屻傛墦寮緙栬瘧鐢熸垚鐨?cod"鏂囦歡錛屾垜鏈哄櫒涓婄敓鎴愮殑鏂囦歡鍐呭濡備笅:
TITLE E:\Crash\Crash銆俢pp .386P include listing.inc if @Version gt 510 .model FLAT else _TEXT SEGMENT PARA USE32 PUBLIC ''CODE'' _TEXT ENDS _DATA SEGMENT DWORD USE32 PUBLIC ''DATA'' _DATA ENDS CONST SEGMENT DWORD USE32 PUBLIC ''CONST'' CONST ENDS _BSS SEGMENT DWORD USE32 PUBLIC ''BSS'' _BSS ENDS $$SYMBOLS SEGMENT BYTE USE32 ''DEBSYM'' $$SYMBOLS ENDS $$TYPES SEGMENT BYTE USE32 ''DEBTYP'' $$TYPES ENDS _TLS SEGMENT DWORD USE32 PUBLIC ''TLS'' _TLS ENDS ; COMDAT _main _TEXT SEGMENT PARA USE32 PUBLIC ''CODE'' _TEXT ENDS ; COMDAT ?Crash1@@YAXXZ _TEXT SEGMENT PARA USE32 PUBLIC ''CODE'' _TEXT ENDS FLAT GROUP _DATA錛?CONST, _BSS ASSUME CS: FLAT, DS: FLAT, SS: FLAT endif PUBLIC ?Crash1@@YAXXZ ; Crash1 PUBLIC _main EXTRN __chkesp:NEAR ; COMDAT _main _TEXT SEGMENT _main PROC NEAR ; COMDAT ; 9 : { 00000 55 push ebp 00001 8b ec mov ebp錛?esp 00003 83 ec 40 sub esp, 64 ; 00000040H 00006 53 push ebx 00007 56 push esi 00008 57 push edi 00009 8d 7d c0 lea edi, DWORD PTR [ebp-64] 0000c b9 10 00 00 00 mov ecx錛?16 ; 00000010H 00011 b8 cc cc cc cc mov eax錛?-858993460 ; ccccccccH 00016 f3 ab rep stosd ; 10 : Crash1(); 00018 e8 00 00 00 00 call ?Crash1@@YAXXZ ; Crash1 ; 11 : return 0; 0001d 33 c0 xor eax錛?eax ; 12 : } 0001f 5f pop edi 00020 5e pop esi 00021 5b pop ebx 00022 83 c4 40 add esp, 64 ; 00000040H 00025 3b ec cmp ebp, esp 00027 e8 00 00 00 00 call __chkesp 0002c 8b e5 mov esp, ebp 0002e 5d pop ebp 0002f c3 ret 0 _main ENDP _TEXT ENDS ; COMDAT ?Crash1@@YAXXZ _TEXT SEGMENT _p$ = -4 ?Crash1@@YAXXZ PROC NEAR ; Crash1, COMDAT ; 15 : { 00000 55 push ebp 00001 8b ec mov ebp, esp 00003 83 ec 44 sub esp, 68 ; 00000044H 00006 53 push ebx 00007 56 push esi 00008 57 push edi 00009 8d 7d bc lea edi, DWORD PTR [ebp-68] 0000c b9 11 00 00 00 mov ecx, 17 ; 00000011H 00011 b8 cc cc cc cc mov eax, -858993460 ; ccccccccH 00016 f3 ab rep stosd ; 16 : char * p =(char*)100; 00018 c7 45 fc 64 00 00 00 mov DWORD PTR _p$[ebp], 100 ; 00000064H ; 17 : *p=100; 0001f 8b 45 fc mov eax, DWORD PTR _p$[ebp] 00022 c6 00 64 mov BYTE PTR [eax], 100 ; 00000064H ; 18 : } 00025 5f pop edi 00026 5e pop esi 00027 5b pop ebx 00028 8b e5 mov esp, ebp 0002a 5d pop ebp 0002b c3 ret 0 ?Crash1@@YAXXZ ENDP ; Crash1 _TEXT ENDS END
鍏朵腑
?Crash1@@YAXXZ PROC NEAR ; Crash1, COMDAT
涓篊rash1姹囩紪浠g爜鐨勮搗濮嬭銆備駭鐢熷穿婧冪殑浠g爜渚垮湪鍏跺悗鐨勬煇涓綅緗傛帴涓嬪幓鐨勪竴琛屼負:
; 15 : {
鍐掑彿鍚庣殑"{"琛ㄧず婧愭枃浠朵腑鐨勮鍙ワ紝鍐掑彿鍓嶇殑"15"琛ㄧず璇ヨ鍙ュ湪婧愭枃浠朵腑鐨勮鏁般?榪欎箣鍚庢樉紺鴻璇彞姹囩紪鍚庣殑鍋忕Щ鍦板潃錛屼簩榪涘埗鐮侊紝姹囩紪浠g爜銆傚
00000 55 push ebp
鍏朵腑"0000"琛ㄧず鐩稿浜庡嚱鏁板紑濮嬪湴鍧鍚庣殑鍋忕Щ錛?55"涓虹紪璇戝悗鐨勬満鍣ㄤ唬鐮侊紝" push ebp"涓烘眹緙栦唬鐮併備粠"cod"鏂囦歡涓垜浠彲浠ョ湅鍑猴紝涓鏉?c/c++)璇彞閫氬父闇瑕佺紪璇戞垚鏁版潯姹囩紪璇彞 銆傛澶栨湁浜涙眹緙栬鍙ュお闀垮垯浼氬垎涓よ鏄劇ず濡?
00018 c7 45 fc 64 00 00 00 mov DWORD PTR _p$[ebp], 100 ; 00000064H
鍏朵腑"0018"琛ㄧず鐩稿鍋忕Щ錛屽湪debug鐗堟湰涓紝榪欎釜鏁版嵁涓虹浉瀵逛簬鍑芥暟璧峰鍦板潃鐨勫亸縐?姝ゆ椂姣忎釜鍑芥暟絎竴鏉¤鍙ョ浉瀵瑰亸縐諱負0000)錛況elease鐗堟湰涓負鐩稿浜庝唬鐮佹絎竴鏉¤鍙ョ殑鍋忕Щ(鍗充唬鐮佹絎竴鏉¤鍙ョ浉瀵瑰亸縐諱負0000錛岃屼互鍚庣殑姣忎釜鍑芥暟絎竴鏉¤鍙ョ浉瀵瑰亸縐誨氨涓嶄負0000浜?銆?c7 45 fc 64 00 00 00 "涓虹紪璇戝悗鐨勬満鍣ㄤ唬鐮?錛?mov DWORD PTR _p$[ebp]錛?100"涓烘眹緙栦唬鐮侊紝 姹囩紪璇█涓?;"鍚庣殑鍐呭涓烘敞閲婏紝鎵浠?;00000064H"錛屾槸涓敞閲婅繖閲岀敤鏉ヨ鏄?00杞崲鎴?6榪涘埗鏃朵負"00000064H"銆?br>鎺ヤ笅鍘伙紝鎴戜滑寮濮嬫潵瀹氫綅浜х敓宕╂簝鐨勮鍙ャ?br>絎竴姝ワ紝璁$畻宕╂簝鍦板潃鐩稿浜庡穿婧冨嚱鏁扮殑鍋忕Щ錛屽湪鏈緥涓凡緇忕煡閬撲簡宕╂簝璇彞鐨勫湴鍧(0x00401082)錛屽拰瀵瑰簲鍑芥暟鐨勮搗濮嬪湴鍧(0x00401060)錛屾墍浠ュ穿婧冨湴鍧鐩稿鍑芥暟璧峰鍦板潃鐨勫亸縐誨氨寰堝鏄撹綆椾簡:
宕╂簝鍋忕Щ鍦板潃 = 宕╂簝璇彞鍦板潃 - 宕╂簝鍑芥暟鐨勮搗濮嬪湴鍧 = 0x00401082 - 0x00401060 = 0x22銆?/pre>絎簩姝ワ紝璁$畻鍑洪敊鐨勬眹緙栬鍙ュ湪cod鏂囦歡涓殑鐩稿鍋忕Щ銆傛垜浠彲浠ョ湅鍒板嚱鏁癈rash1()鍦╟od鏂囦歡涓殑鐩稿鍋忕Щ鍦板潃涓?000錛屽垯
宕╂簝璇彞鍦╟od鏂囦歡涓殑鐩稿鍋忕Щ = 宕╂簝鍑芥暟鍦╟od鏂囦歡涓浉瀵瑰亸縐?+ 宕╂簝鍋忕Щ鍦板潃 = 0x0000 + 0x22 = 0x22絎笁姝ワ紝鎴戜滑鐪婥rash1鍑芥暟鍋忕Щ0x22闄ょ殑浠g爜鏄粈涔?緇撴灉濡備笅
00022 c6 00 64 mov BYTE PTR [eax], 100 ; 00000064H榪欏彞姹囩紪璇彞琛ㄧず灝?00榪欎釜鏁頒繚瀛樺埌瀵勫瓨鍣╡ax鎵鎸囩殑鍐呭瓨鍗曞厓涓幓錛屼繚瀛樼┖闂村ぇ灝忎負1涓瓧鑺?byte)銆傜▼搴忔鏄墽琛岃繖鏉″懡浠ゆ椂浜х敓浜嗗穿婧冿紝鏄劇劧榪欓噷eax涓殑涓轟竴涓潪娉曞湴鍧 錛屾墍浠ョ▼搴忓穿婧冧簡!
絎洓姝ワ紝鍐嶆煡鐪嬭姹囩紪璇彞鍦ㄥ叾鍓嶉潰鍑犺鐨勫叾瀵瑰簲鐨勬簮浠g爜錛岀粨鏋滃涓?; 17 : *p=100;鍏朵腑17琛ㄧず璇ヨ鍙ヤ綅浜庢簮鏂囦歡涓17琛岋紝鑰?#8220;*p=100;”榪欐鏄簮鏂囦歡涓駭鐢熷穿婧冪殑璇彞銆?br>鑷蟲鎴戜滑浠呬粠宕╂簝鍦板潃灝辨煡鎵懼嚭浜嗛犳垚宕╂簝鐨勬簮浠g爜璇彞鍜岃璇彞鎵鍦ㄦ簮鏂囦歡涓殑紜垏浣嶇疆錛岀敋鑷蟲煡鎵懼埌浜嗛犳垚宕╂簝鐨勭紪璇戝悗鐨勭‘鍒囨眹緙栦唬鐮?
鎬庝箞鏍鳳紝鏄笉鏄劅瑙夋洿鐖藉晩?
浜斻佸皬鑺?/strong>
1銆佹柊鏂規硶鍚屾牱瑕佹敞鎰忓彲浠ラ傜敤鐨勮寖鍥達紝鍗崇▼搴忕敱涓鏉¤鍙ュ綋鍗沖紩璧風殑宕╂簝銆傚彟澶栨垜涓嶇煡閬撻櫎浜哣C6澶栵紝鏄惁榪樻湁鍏朵粬鐨勭紪璇戝櫒鑳藉浜х敓綾諱技鐨?cod"鏂囦歡銆?br>2銆佹垜浠彲浠ラ氳繃姣旇緝 鏂版柟娉曚駭鐢熺殑debug鍜宺eleae鐗堟湰鐨?cod"鏂囦歡錛屾煡鎵鵑偅浜涗粎release鐗堟湰(鎴杁ebug鐗堟湰)鏈夊彟涓涓増鏈病鏈夌殑bug(鎴栧叾浠栨х姸)銆備緥濡?緗楁枃"涓墍涓劇殑閭d釜鐢ㄤ緥 錛屽彧瑕佹墦寮release鐗堟湰鐨?cod"鏂囦歡錛屽氨鏄庣櫧浜嗕負鍟ebug鐗堟湰浼氫駭鐢熷穿婧冭宺elease鐗堟湰鍗存病鏈?鍘熸潵release鐗堟湰涓駭鐢熷穿婧冪殑璇彞鍏跺疄鏍規湰閮芥病鏈夌紪璇?銆傚悓鏍鋒湰渚嬩腑鐨剅elease鐗堟湰瑕佺湅鍒板穿婧冪殑鏁堟灉錛岄渶瑕佸皢緙栬瘧閫夐」鏀逛負涓轟笉浼樺寲鐨勯厤緗?/p>
]]>
DeinoMPI鏄井杞?/span>windows涓?/span>MPI-2鐨勪竴涓疄鐜般?/span>
娉細MPI-2鏄?/span>Message Passing Interface, http://www.mpi-forum.org/銆?/span>What is MPI? MPI is a library of functions and macros which is intended for use in programs that exploit the existence of multiple processors by message-passing. 涔熷氨鏄錛?/span>MPI鏄竴濂楄鑼冿紝瀹氫箟浜嗕竴浜涘嚱鏁板拰瀹忥紝瀹冭鐢ㄦ潵鍦ㄧ▼搴忎腑閫氳繃娑堟伅浼犻掓潵鍙戞尌澶氬鐞嗗櫒鐨勫鐞嗚兘鍔涖?/span>
DeinoMPI is an implementation of the MPI-2 standard for parallel computing or more generally it is system level middle-ware for high performance parallel computing on Microsoft Windows systems. It supports Win32 and Win64 machines.
DeinoMPI鏄?/span>MPI-2鐨勪竴涓疄鐜幫紝MPI-2鏄?/span>for騫惰璁$畻鐨勩傛洿閫氱敤鍦拌錛?/span>DeinoMPI鏄?/span>windows緋葷粺涓婄殑涓涓珮鎬ц兘騫惰璁$畻鐨勭郴緇?/span>level涓棿浠躲傚畠鏈変袱涓増鏈紝鍒嗗埆鏄?/span>for win32鍜?/span>for win64鐨勩?/span>
1) DeinoMPI provides the libraries necessary for software developers to write parallel applications that conform to the MPI-2 standard for parallel computing. Software developers who wish to develop new parallel applications or wish to add parallel capabilities to existing software would benefit from using DeinoMPI. The libraries provided support a wide range of C, C++ and Fortran compilers.
2) DeinoMPI also provides a process manager used to start processes on multiple machines in a cluster remotely. Microsoft Windows does not provide native capability to start user applications on remote machines. DeinoMPI provides a secure mechanism to do just that. The primary purpose of the DeinoMPI process manager is to set up the environment and launch processes used in MPI jobs but it is not restricted to this functionality. It can launch any application remotely on behalf of the user.
The following users will benefit from DeinoMPI: Businesses that develop software and wish to add parallel capabilities to increase the performance of their software. Research institutions that have parallel software codes that they want to run on their Windows machines. Universities or other educational institutions that teach courses on parallel computing. University or research labs that run computationally intensive software and wish to use parallel versions of their software to better utilize their computer resources. Students or hobbyists that wish to write parallel programs.
浠ヤ笅鍐嶇敤鍥炬潵琛ㄧず:
鍦?/span>VC絳夌粷澶у鏁?/span>C緙栬瘧鍣ㄤ腑錛岄粯璁ゆ儏鍐典笅錛屽弬鏁拌繘鏍堢殑欏哄簭鏄敱鍙沖悜宸︾殑錛屽洜姝わ紝鍙傛暟榪涙爤浠ュ悗鐨勫唴瀛樻ā鍨嬪涓嬪浘鎵紺猴細鏈鍚庝竴涓浐瀹氬弬鏁扮殑鍦板潃浣嶄簬絎竴涓彲鍙樺弬鏁頒箣涓嬶紝騫朵笖鏄繛緇瓨鍌ㄧ殑銆?/span>
|鈥斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺攟
|鏈鍚庝竴涓彲鍙樺弬鏁?/span> | ->楂樺唴瀛樺湴鍧澶?/span>
|鈥斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺攟
...................
|鈥斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺攟
|絎?/span>N涓彲鍙樺弬鏁?/span> | ->va_arg(arg_ptr,int)鍚?/span>arg_ptr鎵鎸囩殑鍦版柟,
| | 鍗崇N涓彲鍙樺弬鏁扮殑鍦板潃銆?/span>
|鈥斺斺斺斺斺斺斺斺斺斺斺斺斺斺?|
………………………….
|鈥斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺攟
|絎竴涓彲鍙樺弬鏁?/span> | ->va_start(arg_ptr,start)鍚?/span>arg_ptr鎵鎸囩殑鍦版柟
| | 鍗崇涓涓彲鍙樺弬鏁扮殑鍦板潃
|鈥斺斺斺斺斺斺斺斺斺斺斺斺斺斺?|
|鈥斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺?鈥斺攟
| |
|鏈鍚庝竴涓浐瀹氬弬鏁?/span> | -> start鐨勮搗濮嬪湴鍧
|鈥斺斺斺斺斺斺斺斺斺斺斺斺斺?鈥攟 .................
|鈥斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺斺?|
| |
|鈥斺斺斺斺斺斺斺斺斺斺斺斺斺斺?|-> 浣庡唴瀛樺湴鍧澶?/span>
涓?/span>.printf鐮旂┒
涓嬮潰鏄竴涓畝鍗曠殑printf鍑芥暟鐨勫疄鐜幫紝鍙傝冧簡涓殑156欏電殑渚嬪瓙錛岃鑰呭彲浠ョ粨鍚堜功涓婄殑浠g爜涓庢湰鏂囧弬鐓с?/span>
#include "stdio.h"
#include "stdlib.h"
void myprintf(char* fmt, ...) //涓涓畝鍗曠殑綾諱技浜?/span>printf鐨勫疄鐜幫紝//鍙傛暟蹇呴』閮芥槸int 綾誨瀷
{
char* pArg=NULL; //絳変環浜庡師鏉ョ殑va_list
char c;
pArg = (char*) &fmt; //娉ㄦ剰涓嶈鍐欐垚p = fmt !!鍥犱負榪欓噷瑕佸//鍙傛暟鍙栧潃錛岃屼笉鏄彇鍊?/span>
pArg += sizeof(fmt); //絳変環浜庡師鏉ョ殑va_start
do
{
c =*fmt;
if (c != '%')
{
putchar(c); //鐓у師鏍瘋緭鍑哄瓧絎?/span>
}
else
{
//鎸夋牸寮忓瓧絎﹁緭鍑烘暟鎹?/span>
switch(*++fmt)
{
case 'd':
printf("%d",*((int*)pArg));
break;
case 'x':
printf("%#x",*((int*)pArg));
break;
default:
break;
}
pArg += sizeof(int); //絳変環浜庡師鏉ョ殑va_arg
}
++fmt;
}while (*fmt != '\0');
pArg = NULL; //絳変環浜?/span>va_end
return;
}
int main(int argc, char* argv[])
{
int i = 1234;
int j = 5678;
myprintf("the first test:i=%d",i,j);
myprintf("the secend test:i=%d; %x;j=%d;",i,0xabcd,j);
system("pause");
return 0;
}
鍦?/span>intel+win2k+vc6鐨勬満鍣ㄦ墽琛岀粨鏋滃涓嬶細
the first test:i=1234
the secend test:i=1234; 0xabcd;j=5678;
鍥?/span>.搴旂敤
姹傛渶澶у?/span>:
#include //涓嶅畾鏁扮洰鍙傛暟闇瑕佺殑瀹?/span>
int max(int n,int num,...)
{
va_list x;//璇存槑鍙橀噺x
va_start(x,num);//x琚垵濮嬪寲涓烘寚鍚?/span>num鍚庣殑絎竴涓弬鏁?/span>
int m=num;
for(int i=1;i {
//灝嗗彉閲?/span>x鎵鎸囧悜鐨?/span>int綾誨瀷鐨勫艱祴緇?/span>y,鍚屾椂浣?/span>x鎸囧悜涓嬩竴涓弬鏁?/span>
int y=va_arg(x,int);
if(y>m)m=y;
}
va_end(x);//娓呴櫎鍙橀噺x
return m;
}
main()
{
printf("%d,%d",max(3,5,56),max(6,0,4,32,45,533));
}
鏈枃杞澆鑷綉涓婏紝鏈潵鏄娉ㄦ槑鍑哄鐨勶紝緇撴灉鍒漢涔熼兘鏄漿杞界殑錛屽懙鍛點備笉榪囨鏂囪鐨勫緢涓嶉敊錛屽緢娓呮錛岀壒鍒槸鎶婂彲鍙樺弬鏁板疄鐜扮殑閭e嚑涓畯錛佸伓涔熸槸鍐茬潃榪欏嚑涓畯鍘葷殑銆?/span>
#define _INTSIZEOF(n) ( (sizeof(n) + sizeof(int) - 1) & ~(sizeof(int) - 1) )
榪欎釜瀹忥紝涓寮濮嬫垜灝辨槸鎯充笉鏄庣櫧錛佷笉鐭ラ亾鏄佷簡錛岃繕鏄浜嗭紝鎴栬呮槸鐢熼攬浜嗐傛兂浜嗗ソ涓浼氳繕鏄病鎼炴槑鐧斤紝涓嶈繃鐪嬩簡涓涓嬫湰鏂囩殑鍒嗘瀽錛屼竴涓嬪瓙灝辨槑鐧戒簡錛岄偅鏄浉褰撶殑鎭嶇劧澶ф偀鍟娿?/span>
#define va_arg(ap,t) ( *(t *)((ap += _INTSIZEOF(t)) - _INTSIZEOF(t)) )
榪欎釜瀹忥紝涓寮濮嬩篃鏄病鏈夋槑鐧姐傚鐪嬩簡濂藉嚑閬嶆墠鍙戠幇浜嗗ゥ縐樻墍鍦ㄥ晩錛屼負浠涔堣鍔犱竴涓紝鐒跺悗鍐嶅噺涓涓憿錛熷洜涓虹涓涓姞鐩存帴鍔犲埌ap涓婂幓浜嗭紝鑰屽悗涓涓噺鍙槸鍑忎簡涓涓嬫嫭鍙峰唴鐨勫鹼紝涔熷氨鏄綋鍓嶅間簡銆?/span>
瀹忕湡鏄帀瀹沖晩錛佹垨鑰呰瀹冨簲鐢ㄧ湡騫匡紒榪欎笉紱佽鎴戞兂璧蜂互鍓嶇湅榪囩殑瀹忥紝鎬庝箞鍒ゆ柇鏄?/span>win榪樻槸linux騫沖彴鐨勶紝鎬庝箞鍒ゆ柇鏄?/span>32浣嶇殑榪樻槸64浣嶇殑銆傚畯鏄竴闂ㄥ闂晩銆?/span>
鏈枃鐨勫彟涓澶т紭鐐規槸錛屾湁闈炲父綆鍗曠殑渚嬪瓙錛岀湅浜嗗氨鎳傘傛仼銆傜湅浜嗕繚綆′綘灝變細鐢ㄤ簡銆備笉榪囪繖騫村ご鎸囬拡涔熸槸涓ソ涓滆タ鍟婏紝闇瑕佷粈涔堬紝浼犱釜鎸囬拡灝辨槸浼犱簡涓鍒囨兂瑕佺殑涓滆タ鍟婏紝鍙璁╂寚閽堟寚鍚戜綘闇瑕佺殑涓滆タ錛屽彲浠ユ槸浠繪剰澶氱殑鍙傛暟錛堜笉榪囪繖鏍峰瓙鐨勮瘽錛屽叿浣撳埌鍝釜鍙傛暟緇撴潫灝辮鎴戜滑鑷繁鏉ュ畾浜嗭紝涓嶅儚榪欓噷錛屾墍鏈夌殑鍙傛暟閮藉凡緇忓帇鏍堜簡錛岀紪璇戝櫒鍙互甯垜浠喅瀹氬叿浣撴湁澶氬皯涓弬鏁幫紝鍒頒粈涔堟椂鍊欑粨鏉燂級銆?/span>
Have fun.