﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-C++中的一粒沙子</title><link>http://www.cppblog.com/wangxiaoguang/</link><description>学习C++，做应用开发</description><language>zh-cn</language><lastBuildDate>Tue, 07 Apr 2026 21:35:38 GMT</lastBuildDate><pubDate>Tue, 07 Apr 2026 21:35:38 GMT</pubDate><ttl>60</ttl><item><title>MFC中的数据类型</title><link>http://www.cppblog.com/wangxiaoguang/archive/2006/05/11/6913.html</link><dc:creator>炙热的太阳</dc:creator><author>炙热的太阳</author><pubDate>Thu, 11 May 2006 01:00:00 GMT</pubDate><guid>http://www.cppblog.com/wangxiaoguang/archive/2006/05/11/6913.html</guid><wfw:comment>http://www.cppblog.com/wangxiaoguang/comments/6913.html</wfw:comment><comments>http://www.cppblog.com/wangxiaoguang/archive/2006/05/11/6913.html#Feedback</comments><slash:comments>4</slash:comments><wfw:commentRss>http://www.cppblog.com/wangxiaoguang/comments/commentRss/6913.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/wangxiaoguang/services/trackbacks/6913.html</trackback:ping><description><![CDATA[  <font size="2">对于像我这样刚接触MFC不久的人来说，MFC中的数据类型的确让人很头痛，需要不时地去查找MSDN，找的多了，就记下来了一部分，于是贴出来，加强记忆！<br /><br /><p class="MsoNormal" style="TEXT-JUSTIFY: inter-ideograph; MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: justify"><span lang="EN-US"><table style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-LEFT: medium none; BORDER-BOTTOM: medium none; BORDER-COLLAPSE: collapse; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 0cm 5.4pt 0cm 5.4pt" cellspacing="0" cellpadding="0" border="1"><tbody><tr><td style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 0.5pt solid; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: windowtext 0.5pt solid; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent" valign="top"><p class="MsoNormal" style="TEXT-JUSTIFY: inter-ideograph; MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: justify"><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">数据类型</span></p></td><td style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 0.5pt solid; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: #d4d0c8; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; mso-border-left-alt: solid windowtext .5pt" valign="top"><p class="MsoNormal" style="TEXT-JUSTIFY: inter-ideograph; MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: justify"><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">意义</span></p></td></tr><tr><td style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #d4d0c8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: windowtext 0.5pt solid; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; mso-border-top-alt: solid windowtext .5pt" valign="top"><p class="MsoNormal" style="TEXT-JUSTIFY: inter-ideograph; MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: justify"><span lang="EN-US">BOOL</span></p></td><td style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #d4d0c8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: #d4d0c8; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; mso-border-top-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt" valign="top"><p class="MsoNormal" style="TEXT-JUSTIFY: inter-ideograph; MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: justify"><span lang="EN-US">Boolean</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">值（</span><span lang="EN-US">TRUE<span style="mso-spacerun: yes">  </span>or FALSE</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">）</span></p></td></tr><tr><td style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #d4d0c8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: windowtext 0.5pt solid; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; mso-border-top-alt: solid windowtext .5pt" valign="top"><p class="MsoNormal" style="TEXT-JUSTIFY: inter-ideograph; MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: justify"><span lang="EN-US">BSTR</span></p></td><td style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #d4d0c8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: #d4d0c8; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; mso-border-top-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt" valign="top"><p class="MsoNormal" style="TEXT-JUSTIFY: inter-ideograph; MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: justify"><span lang="EN-US">32-bit</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">字符指针</span></p></td></tr><tr><td style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #d4d0c8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: windowtext 0.5pt solid; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; mso-border-top-alt: solid windowtext .5pt" valign="top"><p class="MsoNormal" style="TEXT-JUSTIFY: inter-ideograph; MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: justify"><span lang="EN-US">BYTE</span></p></td><td style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #d4d0c8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: #d4d0c8; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; mso-border-top-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt" valign="top"><p class="MsoNormal" style="TEXT-JUSTIFY: inter-ideograph; MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: justify"><span lang="EN-US">8-bit</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">整数，无正负号</span></p></td></tr><tr><td style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #d4d0c8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: windowtext 0.5pt solid; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; mso-border-top-alt: solid windowtext .5pt" valign="top"><p class="MsoNormal" style="TEXT-JUSTIFY: inter-ideograph; MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: justify"><span lang="EN-US">COLORREF</span></p></td><td style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #d4d0c8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: #d4d0c8; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; mso-border-top-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt" valign="top"><p class="MsoNormal" style="TEXT-JUSTIFY: inter-ideograph; MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: justify"><span lang="EN-US">32-bit</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">数值，代表一个颜色值</span></p></td></tr><tr><td style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #d4d0c8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: windowtext 0.5pt solid; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; mso-border-top-alt: solid windowtext .5pt" valign="top"><p class="MsoNormal" style="TEXT-JUSTIFY: inter-ideograph; MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: justify"><span lang="EN-US">DWORD</span></p></td><td style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #d4d0c8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: #d4d0c8; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; mso-border-top-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt" valign="top"><p class="MsoNormal" style="TEXT-JUSTIFY: inter-ideograph; MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: justify"><span lang="EN-US">32-bit</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">整数，无正负号</span></p></td></tr><tr><td style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #d4d0c8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: windowtext 0.5pt solid; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; mso-border-top-alt: solid windowtext .5pt" valign="top"><p class="MsoNormal" style="TEXT-JUSTIFY: inter-ideograph; MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: justify"><span lang="EN-US">LONG</span></p></td><td style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #d4d0c8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: #d4d0c8; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; mso-border-top-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt" valign="top"><p class="MsoNormal" style="TEXT-JUSTIFY: inter-ideograph; MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: justify"><span lang="EN-US">32-bit</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">整数，有正负号</span></p></td></tr><tr><td style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #d4d0c8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: windowtext 0.5pt solid; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; mso-border-top-alt: solid windowtext .5pt" valign="top"><p class="MsoNormal" style="TEXT-JUSTIFY: inter-ideograph; MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: justify"><span lang="EN-US">LPARAM</span></p></td><td style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #d4d0c8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: #d4d0c8; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; mso-border-top-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt" valign="top"><p class="MsoNormal" style="TEXT-JUSTIFY: inter-ideograph; MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: justify"><span lang="EN-US">32-bit</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">数值，作为窗口函数或</span><span lang="EN-US">callback</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">函数的一个参数</span></p></td></tr><tr><td style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #d4d0c8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: windowtext 0.5pt solid; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; mso-border-top-alt: solid windowtext .5pt" valign="top"><p class="MsoNormal" style="TEXT-JUSTIFY: inter-ideograph; MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: justify"><span lang="EN-US">LPCSTR</span></p></td><td style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #d4d0c8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: #d4d0c8; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; mso-border-top-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt" valign="top"><p class="MsoNormal" style="TEXT-JUSTIFY: inter-ideograph; MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: justify"><span lang="EN-US">32-bit</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">指针，指向一个常数字符串</span></p></td></tr><tr><td style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #d4d0c8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: windowtext 0.5pt solid; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; mso-border-top-alt: solid windowtext .5pt" valign="top"><p class="MsoNormal" style="TEXT-JUSTIFY: inter-ideograph; MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: justify"><span lang="EN-US">LPSTR</span></p></td><td style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #d4d0c8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: #d4d0c8; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; mso-border-top-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt" valign="top"><p class="MsoNormal" style="TEXT-JUSTIFY: inter-ideograph; MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: justify"><span lang="EN-US">32-bit</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">指针，指向一个字符串</span></p></td></tr><tr><td style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #d4d0c8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: windowtext 0.5pt solid; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; mso-border-top-alt: solid windowtext .5pt" valign="top"><p class="MsoNormal" style="TEXT-JUSTIFY: inter-ideograph; MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: justify"><span lang="EN-US">LPCTSTR</span></p></td><td style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #d4d0c8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: #d4d0c8; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; mso-border-top-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt" valign="top"><p class="MsoNormal" style="TEXT-JUSTIFY: inter-ideograph; MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: justify"><span lang="EN-US">32-bit</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">指针，指向一个常数字符串。此字符串可移植到</span><span lang="EN-US">Unicode</span></p></td></tr><tr><td style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #d4d0c8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: windowtext 0.5pt solid; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; mso-border-top-alt: solid windowtext .5pt" valign="top"><p class="MsoNormal" style="TEXT-JUSTIFY: inter-ideograph; MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: justify"><span lang="EN-US">LPTSTR</span></p></td><td style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #d4d0c8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: #d4d0c8; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; mso-border-top-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt" valign="top"><p class="MsoNormal" style="TEXT-JUSTIFY: inter-ideograph; MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: justify"><span lang="EN-US">32-bit</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">指针，指向一个字符串。此字符串可移植到</span><span lang="EN-US">Unicode</span></p></td></tr><tr><td style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #d4d0c8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: windowtext 0.5pt solid; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; mso-border-top-alt: solid windowtext .5pt" valign="top"><p class="MsoNormal" style="TEXT-JUSTIFY: inter-ideograph; MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: justify"><span lang="EN-US">LPVOID</span></p></td><td style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #d4d0c8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: #d4d0c8; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; mso-border-top-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt" valign="top"><p class="MsoNormal" style="TEXT-JUSTIFY: inter-ideograph; MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: justify"><span lang="EN-US">32-bit</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">指针，指向一个未指定类型的数据</span></p></td></tr><tr><td style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #d4d0c8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: windowtext 0.5pt solid; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; mso-border-top-alt: solid windowtext .5pt" valign="top"><p class="MsoNormal" style="TEXT-JUSTIFY: inter-ideograph; MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: justify"><span lang="EN-US">LPRESULT</span></p></td><td style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #d4d0c8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: #d4d0c8; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; mso-border-top-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt" valign="top"><p class="MsoNormal" style="TEXT-JUSTIFY: inter-ideograph; MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: justify"><span lang="EN-US">32-bit</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">数值，作为窗口函数或</span><span lang="EN-US">callback</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">函数的返回值</span></p></td></tr><tr><td style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #d4d0c8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: windowtext 0.5pt solid; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; mso-border-top-alt: solid windowtext .5pt" valign="top"><p class="MsoNormal" style="TEXT-JUSTIFY: inter-ideograph; MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: justify"><span lang="EN-US">UINT</span></p></td><td style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #d4d0c8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: #d4d0c8; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; mso-border-top-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt" valign="top"><p class="MsoNormal" style="TEXT-JUSTIFY: inter-ideograph; MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: justify"><span lang="EN-US">Win16</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中，</span><span lang="EN-US">16</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">－</span><span lang="EN-US">bit</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">无正负号，</span><span lang="EN-US">Win32</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中，</span><span lang="EN-US">32</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">－</span><span lang="EN-US">bit</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">无正负号</span></p></td></tr><tr><td style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #d4d0c8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: windowtext 0.5pt solid; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; mso-border-top-alt: solid windowtext .5pt" valign="top"><p class="MsoNormal" style="TEXT-JUSTIFY: inter-ideograph; MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: justify"><span lang="EN-US">WNDPROC</span></p></td><td style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #d4d0c8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: #d4d0c8; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; mso-border-top-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt" valign="top"><p class="MsoNormal" style="TEXT-JUSTIFY: inter-ideograph; MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: justify"><span lang="EN-US">32-bit</span></p></td></tr><tr><td style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #d4d0c8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: windowtext 0.5pt solid; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; mso-border-top-alt: solid windowtext .5pt" valign="top"><p class="MsoNormal" style="TEXT-JUSTIFY: inter-ideograph; MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: justify"><span lang="EN-US">WORD</span></p></td><td style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #d4d0c8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: #d4d0c8; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; mso-border-top-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt" valign="top"><p class="MsoNormal" style="TEXT-JUSTIFY: inter-ideograph; MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: justify"><span lang="EN-US">16</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">－</span><span lang="EN-US">bit</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">整数，无正负号</span></p></td></tr><tr><td style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #d4d0c8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: windowtext 0.5pt solid; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; mso-border-top-alt: solid windowtext .5pt" valign="top"><p class="MsoNormal" style="TEXT-JUSTIFY: inter-ideograph; MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: justify"><span lang="EN-US">WPARAM</span></p></td><td style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #d4d0c8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: #d4d0c8; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; mso-border-top-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt" valign="top"><p class="MsoNormal" style="TEXT-JUSTIFY: inter-ideograph; MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: justify"><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">窗口函数的一个参数，</span><span lang="EN-US">Win16</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中</span><span lang="EN-US">16bits</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，</span><span lang="EN-US">Win32</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中</span><span lang="EN-US">32bits</span></p></td></tr></tbody></table></span></p><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: center" align="center"><span lang="EN-US"><font size="3"> <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /?><o:p></o:p></font></span></p><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: center" align="center"><span lang="EN-US"><font size="3"> <o:p></o:p></font></span></p><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: center" align="center"><font size="3"><span lang="EN-US">MFC</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">独特的数据类型</span></font></p><p class="MsoNormal" style="TEXT-JUSTIFY: inter-ideograph; MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: justify"></p><table style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-LEFT: medium none; BORDER-BOTTOM: medium none; BORDER-COLLAPSE: collapse; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 0cm 5.4pt 0cm 5.4pt" cellspacing="0" cellpadding="0" border="1"><tbody><tr><td style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 0.5pt solid; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: windowtext 0.5pt solid; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent" valign="top"><p class="MsoNormal" style="TEXT-JUSTIFY: inter-ideograph; MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: justify"><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">数据类型</span></p></td><td style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 0.5pt solid; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: #d4d0c8; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; mso-border-left-alt: solid windowtext .5pt" valign="top"><p class="MsoNormal" style="TEXT-JUSTIFY: inter-ideograph; MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: justify"><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">意义</span></p></td></tr><tr><td style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #d4d0c8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: windowtext 0.5pt solid; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; mso-border-top-alt: solid windowtext .5pt" valign="top"><p class="MsoNormal" style="TEXT-JUSTIFY: inter-ideograph; MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: justify"><span lang="EN-US">POSITION</span></p></td><td style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #d4d0c8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: #d4d0c8; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; mso-border-top-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt" valign="top"><p class="MsoNormal" style="TEXT-JUSTIFY: inter-ideograph; MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: justify"><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">一个数值，代表</span><span lang="EN-US">collection</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">对象（例如数组或链表）中的元素位置，常使用于</span><span lang="EN-US">MFC collection classes</span></p></td></tr><tr><td style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #d4d0c8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: windowtext 0.5pt solid; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; mso-border-top-alt: solid windowtext .5pt" valign="top"><p class="MsoNormal" style="TEXT-JUSTIFY: inter-ideograph; MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: justify"><span lang="EN-US">LPCRECT</span></p></td><td style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #d4d0c8; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: #d4d0c8; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; mso-border-top-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt" valign="top"><p class="MsoNormal" style="TEXT-JUSTIFY: inter-ideograph; MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: justify"><span lang="EN-US">32-bit</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">指针，指向一个不变的</span><span lang="EN-US">RECT</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">结构</span></p></td></tr></tbody></table></font><img src ="http://www.cppblog.com/wangxiaoguang/aggbug/6913.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/wangxiaoguang/" target="_blank">炙热的太阳</a> 2006-05-11 09:00 <a href="http://www.cppblog.com/wangxiaoguang/archive/2006/05/11/6913.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Google推出了一款网页设计工具！</title><link>http://www.cppblog.com/wangxiaoguang/archive/2006/05/09/6803.html</link><dc:creator>炙热的太阳</dc:creator><author>炙热的太阳</author><pubDate>Tue, 09 May 2006 00:53:00 GMT</pubDate><guid>http://www.cppblog.com/wangxiaoguang/archive/2006/05/09/6803.html</guid><wfw:comment>http://www.cppblog.com/wangxiaoguang/comments/6803.html</wfw:comment><comments>http://www.cppblog.com/wangxiaoguang/archive/2006/05/09/6803.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/wangxiaoguang/comments/commentRss/6803.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/wangxiaoguang/services/trackbacks/6803.html</trackback:ping><description><![CDATA[
		<font size="4">     <font size="3">Google又有新创意了（Google的每一款新产品都给我带来一些惊喜！），他的名字叫google网页设计工具（Google Page Create），当然这仍然是google工程师利用它们的20%时间开发的，它给人的感觉就像是google做的一个blog。反正大家自己去看看吧！<br /></font><br />     google黑白报上的内容：<br /><br /><font size="3">我们的目标是设计出我们的朋友和家人都喜欢而且易用的产品，经过数月的努力，我们很高兴 </font><a href="https://www.google.com/accounts/ServiceLogin?service=pages&amp;continue=http%3A%2F%2Fpages.google.com%2F&amp;ltmpl=yessignups" target="_blank"><font size="3">Google Page Creator</font></a><font size="3">（Google 网页设计工具）正式加入 </font><a href="http://labs.google.com/" target="_blank"><font size="3">Google 实验室</font></a><font size="3">了。Google 实验室一向是 Google 科技试验的园地，里面有我们觉得激动人心、但可能还没完全成熟的产品。希望早期使用者给我们的产品提意见，帮助我们不断完善改进。</font><br />     <br />     链接地址：<a href="https://www.google.com/accounts/ServiceLogin?service=pages&amp;continue=http%3A%2F%2Fpages.google.com%2F&amp;ltmpl=yessignups" target="_blank">Google Page Creator</a>（Google 网页设计工具）。<br />   </font>
<img src ="http://www.cppblog.com/wangxiaoguang/aggbug/6803.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/wangxiaoguang/" target="_blank">炙热的太阳</a> 2006-05-09 08:53 <a href="http://www.cppblog.com/wangxiaoguang/archive/2006/05/09/6803.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>C++的编写约瑟夫(josephus)环函数（转）</title><link>http://www.cppblog.com/wangxiaoguang/archive/2006/04/29/6445.html</link><dc:creator>炙热的太阳</dc:creator><author>炙热的太阳</author><pubDate>Sat, 29 Apr 2006 01:30:00 GMT</pubDate><guid>http://www.cppblog.com/wangxiaoguang/archive/2006/04/29/6445.html</guid><wfw:comment>http://www.cppblog.com/wangxiaoguang/comments/6445.html</wfw:comment><comments>http://www.cppblog.com/wangxiaoguang/archive/2006/04/29/6445.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/wangxiaoguang/comments/commentRss/6445.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/wangxiaoguang/services/trackbacks/6445.html</trackback:ping><description><![CDATA[
		<font size="4">约瑟夫(josephus)环是这样的：假设有n个小孩坐成一个环，假如从第一个小孩开始数，如果数到m个小孩，则该小该离开，问最后留下的小孩是第几个小孩？例如：总共有6个小孩，围成一圈，从第一个小孩开始，每次数2个小孩，则游戏情况如下：<br />    小孩序号：1，2，3，4，5，6<br />    离开小孩序号：2，4，6，3，1<br />最后获胜小孩序号：5<br /><br />    这样的问题，我可以先考虑输入的内容有哪些？输出内容有哪些？<br />        要求用户输入的内容有：<br />         1、是小孩的个数，也就是n的值；<br />         2、是离开小孩的间隔是多少？也就是m的值。<br />         3、所有小孩的序号要求存在数组或者链表中，所以需要定义一个指针，这里我们用数组来存放小孩的序号。<br />        而要求输出的内容是：<br />         1、离开小孩的序号；<br />         2、最后留下小孩的序号；<br />所以，根据上面分析输入输出参数，我们考虑离开小孩的序号可以直接输出，这样可以使函数的复杂性。那么函数定义如下：<br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /><span style="COLOR: #008000">//</span><span style="COLOR: #008000">输入参数：<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">Childs为指向一个整形指针，指向保存小孩数组的首地址；<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">n为小孩的个数；<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">m为数小孩的个数；</span><span style="COLOR: #008000"><br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> Josephus(</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">Child,</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> n,</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> m)<br /><img id="Codehighlighter1_100_532_Open_Image" onclick="this.style.display='none'; Codehighlighter1_100_532_Open_Text.style.display='none'; Codehighlighter1_100_532_Closed_Image.style.display='inline'; Codehighlighter1_100_532_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_100_532_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_100_532_Closed_Text.style.display='none'; Codehighlighter1_100_532_Open_Image.style.display='inline'; Codehighlighter1_100_532_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span><span id="Codehighlighter1_100_532_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/images/dot.gif" /></span><span id="Codehighlighter1_100_532_Open_Text"><span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> i</span><span style="COLOR: #000000">=-</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">,j</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">,k</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">开始数小孩，只到留下一个小孩</span><span style="COLOR: #008000"><br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">)<br /><img id="Codehighlighter1_146_484_Open_Image" onclick="this.style.display='none'; Codehighlighter1_146_484_Open_Text.style.display='none'; Codehighlighter1_146_484_Closed_Image.style.display='inline'; Codehighlighter1_146_484_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_146_484_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_146_484_Closed_Text.style.display='none'; Codehighlighter1_146_484_Open_Image.style.display='inline'; Codehighlighter1_146_484_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" /></span><span id="Codehighlighter1_146_484_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/images/dot.gif" /></span><span id="Codehighlighter1_146_484_Open_Text"><span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">数m个小孩</span><span style="COLOR: #008000"><br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #000000">  </span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">(j</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;j</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">m;)<br /><img id="Codehighlighter1_174_267_Open_Image" onclick="this.style.display='none'; Codehighlighter1_174_267_Open_Text.style.display='none'; Codehighlighter1_174_267_Closed_Image.style.display='inline'; Codehighlighter1_174_267_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_174_267_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_174_267_Closed_Text.style.display='none'; Codehighlighter1_174_267_Open_Image.style.display='inline'; Codehighlighter1_174_267_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />  </span><span id="Codehighlighter1_174_267_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/images/dot.gif" /></span><span id="Codehighlighter1_174_267_Open_Text"><span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />   i</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">(i</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">)</span><span style="COLOR: #000000">%</span><span style="COLOR: #000000">n;    </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">取下标加1的模，当i的值在0到n-1之间循环</span><span style="COLOR: #008000"><br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #000000">   </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(Child[i]</span><span style="COLOR: #000000">!=-</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">) </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">小孩在环中则数数有效；</span><span style="COLOR: #008000"><br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #000000">    j</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />   <br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />  }</span></span><span style="COLOR: #000000"><br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />   </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(k</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">n)                        </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">如果k==n则表示，此时数组中只留下一个小孩，</span><span style="COLOR: #008000"><br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">break</span><span style="COLOR: #000000">;                          </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">序号为Child[i]中的值，跳出循环;</span><span style="COLOR: #008000"><br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #000000">   cout</span><span style="COLOR: #000000">&lt;&lt;</span><span style="COLOR: #000000">Child[i]</span><span style="COLOR: #000000">&lt;&lt;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">;  </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">输出离开小孩的序号;</span><span style="COLOR: #008000"><br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #000000"><br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />   Child[i]</span><span style="COLOR: #000000">=-</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;               </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">离开的小孩用-1作标记</span><span style="COLOR: #008000"><br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #000000">   k</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">k</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />}</span></span><span style="COLOR: #000000"><br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />cout</span><span style="COLOR: #000000">&lt;&lt;</span><span style="COLOR: #000000">endl;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">(Child[i]);    </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">返回最获胜小孩的序号</span><span style="COLOR: #008000"><br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" /></span><span style="COLOR: #000000">}</span></span><span style="COLOR: #000000"><br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span></div><br />完整的程序，在VC6中调试通过。<br />//-----------------------------------------------------------<br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /><span style="COLOR: #000000">#include</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">iostream.h</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> Josephus(</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">Child,</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> n,</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> m);<br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> main()<br /><img id="Codehighlighter1_71_277_Open_Image" onclick="this.style.display='none'; Codehighlighter1_71_277_Open_Text.style.display='none'; Codehighlighter1_71_277_Closed_Image.style.display='inline'; Codehighlighter1_71_277_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_71_277_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_71_277_Closed_Text.style.display='none'; Codehighlighter1_71_277_Open_Image.style.display='inline'; Codehighlighter1_71_277_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span><span id="Codehighlighter1_71_277_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/images/dot.gif" /></span><span id="Codehighlighter1_71_277_Open_Text"><span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">allChild,j,k,l;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />cin</span><span style="COLOR: #000000">&gt;&gt;</span><span style="COLOR: #000000">j</span><span style="COLOR: #000000">&gt;&gt;</span><span style="COLOR: #000000">k;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />  </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">((allChild</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">[j])</span><span style="COLOR: #000000">!=</span><span style="COLOR: #000000">NULL)<br /><img id="Codehighlighter1_143_275_Open_Image" onclick="this.style.display='none'; Codehighlighter1_143_275_Open_Text.style.display='none'; Codehighlighter1_143_275_Closed_Image.style.display='inline'; Codehighlighter1_143_275_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_143_275_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_143_275_Closed_Text.style.display='none'; Codehighlighter1_143_275_Open_Image.style.display='inline'; Codehighlighter1_143_275_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />  </span><span id="Codehighlighter1_143_275_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/images/dot.gif" /></span><span id="Codehighlighter1_143_275_Open_Text"><span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">(l</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;l</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">j;l</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">)<br /><img id="Codehighlighter1_170_221_Open_Image" onclick="this.style.display='none'; Codehighlighter1_170_221_Open_Text.style.display='none'; Codehighlighter1_170_221_Closed_Image.style.display='inline'; Codehighlighter1_170_221_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_170_221_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_170_221_Closed_Text.style.display='none'; Codehighlighter1_170_221_Open_Image.style.display='inline'; Codehighlighter1_170_221_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span><span id="Codehighlighter1_170_221_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/images/dot.gif" /></span><span id="Codehighlighter1_170_221_Open_Text"><span style="COLOR: #000000">{  <br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />     cout</span><span style="COLOR: #000000">&lt;&lt;</span><span style="COLOR: #000000">l</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">&lt;&lt;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />     allChild[l]</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">l</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />    }</span></span><span style="COLOR: #000000"><br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    cout</span><span style="COLOR: #000000">&lt;&lt;</span><span style="COLOR: #000000">endl;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    cout</span><span style="COLOR: #000000">&lt;&lt;</span><span style="COLOR: #000000">Josephus(allChild,j,k);<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />  }</span></span><span style="COLOR: #000000"><br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span></span><span style="COLOR: #000000"><br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> Josephus(</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">Child,</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> n,</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> m)<br /><img id="Codehighlighter1_317_595_Open_Image" onclick="this.style.display='none'; Codehighlighter1_317_595_Open_Text.style.display='none'; Codehighlighter1_317_595_Closed_Image.style.display='inline'; Codehighlighter1_317_595_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_317_595_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_317_595_Closed_Text.style.display='none'; Codehighlighter1_317_595_Open_Image.style.display='inline'; Codehighlighter1_317_595_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span><span id="Codehighlighter1_317_595_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/images/dot.gif" /></span><span id="Codehighlighter1_317_595_Open_Text"><span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> i</span><span style="COLOR: #000000">=-</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">,j</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">,k</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">)<br /><img id="Codehighlighter1_346_559_Open_Image" onclick="this.style.display='none'; Codehighlighter1_346_559_Open_Text.style.display='none'; Codehighlighter1_346_559_Closed_Image.style.display='inline'; Codehighlighter1_346_559_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_346_559_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_346_559_Closed_Text.style.display='none'; Codehighlighter1_346_559_Open_Image.style.display='inline'; Codehighlighter1_346_559_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" /></span><span id="Codehighlighter1_346_559_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/images/dot.gif" /></span><span id="Codehighlighter1_346_559_Open_Text"><span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />  </span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">(j</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;j</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">m;)<br /><img id="Codehighlighter1_366_422_Open_Image" onclick="this.style.display='none'; Codehighlighter1_366_422_Open_Text.style.display='none'; Codehighlighter1_366_422_Closed_Image.style.display='inline'; Codehighlighter1_366_422_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_366_422_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_366_422_Closed_Text.style.display='none'; Codehighlighter1_366_422_Open_Image.style.display='inline'; Codehighlighter1_366_422_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />  </span><span id="Codehighlighter1_366_422_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/images/dot.gif" /></span><span id="Codehighlighter1_366_422_Open_Text"><span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />   i</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">(i</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">)</span><span style="COLOR: #000000">%</span><span style="COLOR: #000000">n;    <br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />   </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(Child[i]</span><span style="COLOR: #000000">!=-</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">) <br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    j</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />   <br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />  }</span></span><span style="COLOR: #000000"><br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />   </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(k</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">n)                        <br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span><span style="COLOR: #0000ff">break</span><span style="COLOR: #000000">;                        <br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />   cout</span><span style="COLOR: #000000">&lt;&lt;</span><span style="COLOR: #000000">Child[i]</span><span style="COLOR: #000000">&lt;&lt;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">;  <br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />   Child[i]</span><span style="COLOR: #000000">=-</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;         <br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />   k</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">k</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />}</span></span><span style="COLOR: #000000"><br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />cout</span><span style="COLOR: #000000">&lt;&lt;</span><span style="COLOR: #000000">endl;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">(Child[i]);    <br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span></span><span style="COLOR: #000000"><br /><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /></span></div></font>
<img src ="http://www.cppblog.com/wangxiaoguang/aggbug/6445.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/wangxiaoguang/" target="_blank">炙热的太阳</a> 2006-04-29 09:30 <a href="http://www.cppblog.com/wangxiaoguang/archive/2006/04/29/6445.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>google中文名字宣传flash</title><link>http://www.cppblog.com/wangxiaoguang/archive/2006/04/15/5621.html</link><dc:creator>炙热的太阳</dc:creator><author>炙热的太阳</author><pubDate>Sat, 15 Apr 2006 10:26:00 GMT</pubDate><guid>http://www.cppblog.com/wangxiaoguang/archive/2006/04/15/5621.html</guid><wfw:comment>http://www.cppblog.com/wangxiaoguang/comments/5621.html</wfw:comment><comments>http://www.cppblog.com/wangxiaoguang/archive/2006/04/15/5621.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/wangxiaoguang/comments/commentRss/5621.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/wangxiaoguang/services/trackbacks/5621.html</trackback:ping><description><![CDATA[呵呵，google有中文名字了，叫谷歌，很贴近中国大众，这是不是意味着大众搜索时代的到来呢？<br />下面是谷歌的地址：<br /><a href="http://googlechinablog.com/gugeflash.swf">http://googlechinablog.com/gugeflash.swf</a><img src ="http://www.cppblog.com/wangxiaoguang/aggbug/5621.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/wangxiaoguang/" target="_blank">炙热的太阳</a> 2006-04-15 18:26 <a href="http://www.cppblog.com/wangxiaoguang/archive/2006/04/15/5621.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>今天单位组织出去春游！</title><link>http://www.cppblog.com/wangxiaoguang/archive/2006/04/09/5204.html</link><dc:creator>炙热的太阳</dc:creator><author>炙热的太阳</author><pubDate>Sun, 09 Apr 2006 12:36:00 GMT</pubDate><guid>http://www.cppblog.com/wangxiaoguang/archive/2006/04/09/5204.html</guid><wfw:comment>http://www.cppblog.com/wangxiaoguang/comments/5204.html</wfw:comment><comments>http://www.cppblog.com/wangxiaoguang/archive/2006/04/09/5204.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/wangxiaoguang/comments/commentRss/5204.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/wangxiaoguang/services/trackbacks/5204.html</trackback:ping><description><![CDATA[  今天跟单位的人出去到郊外玩了一天，紧张了几个星期的心情总算有一点放松，呵呵，过几天项目就要验收了，所以最近一直都在赶工作。玩了一天有点体会，那就是以后一定要加强体育锻炼，不能把身体搞垮了。<img src ="http://www.cppblog.com/wangxiaoguang/aggbug/5204.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/wangxiaoguang/" target="_blank">炙热的太阳</a> 2006-04-09 20:36 <a href="http://www.cppblog.com/wangxiaoguang/archive/2006/04/09/5204.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>突然间感到很迷茫？？？？？</title><link>http://www.cppblog.com/wangxiaoguang/archive/2006/03/22/4472.html</link><dc:creator>炙热的太阳</dc:creator><author>炙热的太阳</author><pubDate>Wed, 22 Mar 2006 12:08:00 GMT</pubDate><guid>http://www.cppblog.com/wangxiaoguang/archive/2006/03/22/4472.html</guid><wfw:comment>http://www.cppblog.com/wangxiaoguang/comments/4472.html</wfw:comment><comments>http://www.cppblog.com/wangxiaoguang/archive/2006/03/22/4472.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/wangxiaoguang/comments/commentRss/4472.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/wangxiaoguang/services/trackbacks/4472.html</trackback:ping><description><![CDATA[  <font size="2">毕业半年多了，写程序有半年了，今天突然间有点迷茫？？我是不是要继续做程序？我是不是做程序的材料？一连串的问题向我逼来，搞得我一下午没有工作，于是乎上论坛，看大家讨论，思考问题........<br />   莫非这就是人们所说的浮躁，我想可能是吧！人不免在某一件事上做久了，就会产生厌倦感，或者是一时间没有了方向，又或者是没有思想依靠，等等，如此之类。<br />   咳！想发一下感慨，可是怎么也想不起来要怎么写，大学四年，文笔是彻底荒废了，现在想拾起来，可又吐不出什么东西来，有时间写上一大堆东西，回头再一看，自己都想反胃，于是随即删掉，到最后，还是没有写出一点像样的文章来。我比较喜欢林锐（大学十年的作者）的文风，风趣，洒脱又有内涵，我也一直想写他那样的文章来，好歹也算是给自己肯定一下。<br />   算了，又忘词了，上面的已经是把肠子里的东西搅腾了好几遍，不想再折腾自己，就这样自己吧！继续学习C++，继续韩语学习，继续努力！</font><img src ="http://www.cppblog.com/wangxiaoguang/aggbug/4472.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/wangxiaoguang/" target="_blank">炙热的太阳</a> 2006-03-22 20:08 <a href="http://www.cppblog.com/wangxiaoguang/archive/2006/03/22/4472.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>浅谈CMPP协议（二）</title><link>http://www.cppblog.com/wangxiaoguang/archive/2006/03/20/4388.html</link><dc:creator>炙热的太阳</dc:creator><author>炙热的太阳</author><pubDate>Mon, 20 Mar 2006 12:43:00 GMT</pubDate><guid>http://www.cppblog.com/wangxiaoguang/archive/2006/03/20/4388.html</guid><wfw:comment>http://www.cppblog.com/wangxiaoguang/comments/4388.html</wfw:comment><comments>http://www.cppblog.com/wangxiaoguang/archive/2006/03/20/4388.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/wangxiaoguang/comments/commentRss/4388.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/wangxiaoguang/services/trackbacks/4388.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 当SP端和ISMG端建立Connect连接后，我们就要开始发送短信了，而Submit操作的目的是SP在与ISMG建立应用层连接后向ISMG提交短信。ISMG以Submit_Resp消息响应。下面还是要看它的消息定义：字段名字节数属性描述Msg_Id8Unsigned Integer信息标识。Pk_total1Unsigned Integer相同Msg_Id的信息总条数，从1开始。Pk_number...&nbsp;&nbsp;<a href='http://www.cppblog.com/wangxiaoguang/archive/2006/03/20/4388.html'>阅读全文</a><img src ="http://www.cppblog.com/wangxiaoguang/aggbug/4388.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/wangxiaoguang/" target="_blank">炙热的太阳</a> 2006-03-20 20:43 <a href="http://www.cppblog.com/wangxiaoguang/archive/2006/03/20/4388.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>学了一个星期的韩语，有点收获！</title><link>http://www.cppblog.com/wangxiaoguang/archive/2006/03/17/4254.html</link><dc:creator>炙热的太阳</dc:creator><author>炙热的太阳</author><pubDate>Fri, 17 Mar 2006 00:24:00 GMT</pubDate><guid>http://www.cppblog.com/wangxiaoguang/archive/2006/03/17/4254.html</guid><wfw:comment>http://www.cppblog.com/wangxiaoguang/comments/4254.html</wfw:comment><comments>http://www.cppblog.com/wangxiaoguang/archive/2006/03/17/4254.html#Feedback</comments><slash:comments>10</slash:comments><wfw:commentRss>http://www.cppblog.com/wangxiaoguang/comments/commentRss/4254.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/wangxiaoguang/services/trackbacks/4254.html</trackback:ping><description><![CDATA[  前一阵子，我一直想再学一门外语，但害怕学一门新的外语太难，所以就一直没有起步。在一次饭局上我听一个同事说，韩语很简单，一个星期基本上可以入门，很简单的一门语言，而且又是从中文演变过去的，对中国人来说是比较简单。加上最近中国盛行韩风，因此决定学习韩语。于是乎上书店买入门教程，上网上找资料，一个星期下来，嘿！发现韩语还真的挺简单的，挺适合我这种懒散的人学习。可惜，我没有下载朝鲜语插件，不然的我也用韩语写一篇blog！<img src ="http://www.cppblog.com/wangxiaoguang/aggbug/4254.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/wangxiaoguang/" target="_blank">炙热的太阳</a> 2006-03-17 08:24 <a href="http://www.cppblog.com/wangxiaoguang/archive/2006/03/17/4254.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>浅谈CMPP协议（一）</title><link>http://www.cppblog.com/wangxiaoguang/archive/2006/03/15/4160.html</link><dc:creator>炙热的太阳</dc:creator><author>炙热的太阳</author><pubDate>Tue, 14 Mar 2006 23:58:00 GMT</pubDate><guid>http://www.cppblog.com/wangxiaoguang/archive/2006/03/15/4160.html</guid><wfw:comment>http://www.cppblog.com/wangxiaoguang/comments/4160.html</wfw:comment><comments>http://www.cppblog.com/wangxiaoguang/archive/2006/03/15/4160.html#Feedback</comments><slash:comments>8</slash:comments><wfw:commentRss>http://www.cppblog.com/wangxiaoguang/comments/commentRss/4160.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/wangxiaoguang/services/trackbacks/4160.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp; <FONT face=Arial>CMPP协议的全称是中国移动通信互联网短信网关接口协议，它是联想亚信公司根据SMMP协议为中国移动量身定做的，是符合中国国情的一个短信协议，闲话不多说了，说说CMPP的主要功能吧。（1）短信发送（short message mobile originate）MO，就是手机给SP发短信；（2）短信接受（short message mobile terminated）MT，这个就是SP给手机发的短信了，通常我们手机上收到的不良短信就是SP给我们的MT。CMPP协议的通信基础是TCP/IP为底层通信承载的，连接方式是长连接方式。SP与ISMG之间，SMSC和ISMG之间的交互过程中均采用异步方式，即任一个网元在收到请求消息后应立即回应。</FONT> 
<DIV>&nbsp;&nbsp; 下面看看它的消息定义：CMPP中的消息分为消息头和消息体。消息头定义如下 </DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>
<TABLE cellSpacing=0 cellPadding=0 border=1>
<TBODY>
<TR>
<TD vAlign=top width=120>
<P align=center><FONT color=#000000><FONT size=1><SPAN style="FONT-FAMILY: 宋体">字段名</SPAN><B><SPAN lang=EN-US style="FONT-SIZE: 12pt; TEXT-TRANSFORM: uppercase"></SPAN></B></FONT></FONT></P></TD>
<TD vAlign=top width=60>
<P align=center><FONT color=#000000><FONT size=1><SPAN style="FONT-FAMILY: 宋体">字节数</SPAN><B><SPAN lang=EN-US style="FONT-SIZE: 12pt; TEXT-TRANSFORM: uppercase"></SPAN></B></FONT></FONT></P></TD>
<TD vAlign=top width=84>
<P align=center><FONT color=#000000><FONT size=1><SPAN style="FONT-SIZE: 12pt; TEXT-TRANSFORM: uppercase; FONT-FAMILY: 宋体">类型</SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt; TEXT-TRANSFORM: uppercase"></SPAN></FONT></FONT></P></TD>
<TD vAlign=top width=271>
<P align=center><FONT color=#000000><FONT size=1><SPAN style="FONT-FAMILY: 宋体">描述</SPAN><B><SPAN lang=EN-US style="FONT-SIZE: 12pt; TEXT-TRANSFORM: uppercase"></SPAN></B></FONT></FONT></P></TD></TR>
<TR>
<TD vAlign=top width=120>
<P><FONT color=#000000><FONT face="Times New Roman"><FONT size=1><SPAN lang=EN-US>Total_Length<SPAN>&nbsp;&nbsp; </SPAN></SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt"></SPAN></FONT></FONT></FONT></P></TD>
<TD vAlign=top width=60>
<P><SPAN lang=EN-US style="FONT-SIZE: 12pt"><FONT color=#000000><FONT face="Times New Roman"><FONT size=1>4</FONT></FONT></FONT></SPAN></P></TD>
<TD vAlign=top width=84>
<P><SPAN lang=EN-US style="FONT-SIZE: 12pt"><FONT color=#000000><FONT face="Times New Roman"><FONT size=1>Unsigned Integer</FONT></FONT></FONT></SPAN></P></TD>
<TD vAlign=top width=271>
<P><FONT color=#000000><FONT size=1><SPAN style="FONT-FAMILY: 宋体">消息总长度</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">(</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体">含消息头及消息体</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">)</FONT></SPAN></FONT></FONT></P></TD></TR>
<TR>
<TD vAlign=top width=120>
<P><SPAN lang=EN-US><FONT color=#000000><FONT face="Times New Roman"><FONT size=1>Command_Id</FONT></FONT></FONT></SPAN></P></TD>
<TD vAlign=top width=60>
<P><SPAN lang=EN-US style="FONT-SIZE: 12pt"><FONT color=#000000><FONT face="Times New Roman"><FONT size=1>4</FONT></FONT></FONT></SPAN></P></TD>
<TD vAlign=top width=84>
<P><SPAN lang=EN-US style="FONT-SIZE: 12pt"><FONT color=#000000><FONT face="Times New Roman"><FONT size=1>Unsigned Integer</FONT></FONT></FONT></SPAN></P></TD>
<TD vAlign=top width=271>
<P><FONT color=#000000><FONT size=1><SPAN style="FONT-FAMILY: 宋体">命令或响应类型</SPAN><SPAN lang=EN-US></SPAN></FONT></FONT></P></TD></TR>
<TR>
<TD vAlign=top width=120>
<P><SPAN lang=EN-US><FONT color=#000000><FONT face="Times New Roman"><FONT size=1>Sequence_Id</FONT></FONT></FONT></SPAN></P></TD>
<TD vAlign=top width=60>
<P><SPAN lang=EN-US style="FONT-SIZE: 12pt"><FONT color=#000000><FONT face="Times New Roman"><FONT size=1>4</FONT></FONT></FONT></SPAN></P></TD>
<TD vAlign=top width=84>
<P><SPAN lang=EN-US style="FONT-SIZE: 12pt"><FONT color=#000000><FONT face="Times New Roman"><FONT size=1>Unsigned Integer</FONT></FONT></FONT></SPAN></P></TD>
<TD vAlign=top width=271>
<P><FONT color=#000000><FONT size=1><SPAN style="FONT-FAMILY: 宋体">消息流水号</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">,</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体">顺序累加</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">,</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体">步长为</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">1,</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体">循环使用（一对请求和应答消息的流水号必须相同）</SPAN></FONT></FONT><SPAN lang=EN-US></SPAN></P></TD></TR></TBODY></TABLE></DIV>
<DIV>&nbsp;</DIV>
<DIV>那么下面就是SP连接到ISMG上了，看它的Bind连接消息定义</DIV>
<DIV>&nbsp;</DIV>
<DIV>
<TABLE cellSpacing=0 cellPadding=0 border=1>
<TBODY>
<TR>
<TD vAlign=top width=156>
<P align=center><FONT color=#000000><FONT size=1><SPAN style="FONT-FAMILY: 宋体">字段名</SPAN><B><SPAN lang=EN-US style="FONT-SIZE: 12pt; TEXT-TRANSFORM: uppercase"></SPAN></B></FONT></FONT></P></TD>
<TD vAlign=top width=60>
<P align=center><FONT color=#000000><FONT size=1><SPAN style="FONT-FAMILY: 宋体">字节数</SPAN><B><SPAN lang=EN-US style="FONT-SIZE: 12pt; TEXT-TRANSFORM: uppercase"></SPAN></B></FONT></FONT></P></TD>
<TD vAlign=top width=96>
<P align=center><FONT color=#000000><FONT size=1><SPAN style="TEXT-TRANSFORM: uppercase; FONT-FAMILY: 宋体">属性</SPAN><SPAN lang=EN-US style="TEXT-TRANSFORM: uppercase"></SPAN></FONT></FONT></P></TD>
<TD vAlign=top width=240>
<P align=center><FONT color=#000000><FONT size=1><SPAN style="FONT-FAMILY: 宋体">描述</SPAN><B><SPAN lang=EN-US style="FONT-SIZE: 12pt; TEXT-TRANSFORM: uppercase"></SPAN></B></FONT></FONT></P></TD></TR>
<TR>
<TD vAlign=top width=156>
<P><FONT color=#000000><FONT face="Times New Roman"><FONT size=1><SPAN lang=EN-US>Source_Addr<SPAN>&nbsp; </SPAN></SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt"></SPAN></FONT></FONT></FONT></P></TD>
<TD vAlign=top width=60>
<P><SPAN lang=EN-US style="FONT-SIZE: 12pt"><FONT color=#000000><FONT face="Times New Roman"><FONT size=1>6</FONT></FONT></FONT></SPAN></P></TD>
<TD vAlign=top width=96>
<P><SPAN lang=EN-US style="FONT-SIZE: 12pt"><FONT color=#000000><FONT face="Times New Roman"><FONT size=1>Octet String</FONT></FONT></FONT></SPAN></P></TD>
<TD vAlign=top width=240>
<P><FONT color=#000000><FONT size=1><SPAN style="FONT-FAMILY: 宋体">源地址，此处为</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">SP_Id</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体">，即</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">SP</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体">的企业代码。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt"></SPAN></FONT></FONT></P></TD></TR>
<TR>
<TD vAlign=top width=156>
<P><SPAN lang=EN-US style="FONT-SIZE: 12pt"><FONT color=#000000><FONT face="Times New Roman"><FONT size=1>AuthenticatorSource</FONT></FONT></FONT></SPAN></P></TD>
<TD vAlign=top width=60>
<P><SPAN lang=EN-US style="FONT-SIZE: 12pt"><FONT color=#000000><FONT face="Times New Roman"><FONT size=1>16</FONT></FONT></FONT></SPAN></P></TD>
<TD vAlign=top width=96>
<P><SPAN lang=EN-US style="FONT-SIZE: 12pt"><FONT color=#000000><FONT face="Times New Roman"><FONT size=1>Octet String</FONT></FONT></FONT></SPAN></P></TD>
<TD vAlign=top width=240>
<P><FONT color=#000000><FONT size=1><SPAN style="FONT-FAMILY: 宋体">用于鉴别源地址。其值通过单向</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">MD5 hash</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体">计算得出，表示如下：</SPAN><SPAN lang=EN-US></SPAN></FONT></FONT></P>
<P><FONT color=#000000><FONT face="Times New Roman"><FONT size=1><SPAN lang=EN-US>AuthenticatorS</SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt">ource</SPAN><SPAN lang=EN-US> =</SPAN></FONT></FONT></FONT></P>
<P><FONT color=#000000><FONT size=1><SPAN lang=EN-US><FONT face="Times New Roman">MD5</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体">（</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Source_Addr+9 </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体">字节的</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">0 +shared secret+timestamp</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体">）</SPAN><SPAN lang=EN-US></SPAN></FONT></FONT></P>
<P><FONT color=#000000><FONT size=1><SPAN lang=EN-US><FONT face="Times New Roman">Shared secret </FONT></SPAN><SPAN style="FONT-FAMILY: 宋体">由中国移动与源地址实体事先商定，</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">timestamp</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体">格式为：</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">MMDDHHMMSS</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体">，即月日时分秒，</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">10</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体">位。</SPAN><SPAN lang=EN-US></SPAN></FONT></FONT></P></TD></TR>
<TR>
<TD vAlign=top width=156>
<P><SPAN lang=EN-US style="FONT-SIZE: 12pt"><FONT color=#000000><FONT face="Times New Roman"><FONT size=1>Version</FONT></FONT></FONT></SPAN></P></TD>
<TD vAlign=top width=60>
<P><SPAN lang=EN-US style="FONT-SIZE: 12pt"><FONT color=#000000><FONT face="Times New Roman"><FONT size=1>1</FONT></FONT></FONT></SPAN></P></TD>
<TD vAlign=top width=96>
<P><SPAN lang=EN-US style="FONT-SIZE: 12pt"><FONT color=#000000><FONT face="Times New Roman"><FONT size=1>Unsigned Integer</FONT></FONT></FONT></SPAN></P></TD>
<TD vAlign=top width=240>
<P><FONT color=#000000><FONT size=1><SPAN style="FONT-FAMILY: 宋体">双方协商的版本号</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">(</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体">高位</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">4bit</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体">表示主版本号</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">,</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体">低位</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">4bit</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体">表示次版本号</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">)</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体">，对于</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">3.0</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体">的版本，高</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">4bit</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体">为</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">3</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体">，低</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">4</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体">位为</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">0</FONT></SPAN></FONT></FONT></P></TD></TR>
<TR>
<TD vAlign=top width=156>
<P><SPAN lang=EN-US style="FONT-SIZE: 12pt"><FONT color=#000000><FONT face="Times New Roman"><FONT size=1>Timestamp</FONT></FONT></FONT></SPAN></P></TD>
<TD vAlign=top width=60>
<P><SPAN lang=EN-US style="FONT-SIZE: 12pt"><FONT color=#000000><FONT face="Times New Roman"><FONT size=1>4</FONT></FONT></FONT></SPAN></P></TD>
<TD vAlign=top width=96>
<P><FONT color=#000000><FONT face="Times New Roman"><FONT size=1><SPAN lang=EN-US>Unsigned Integer</SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt"></SPAN></FONT></FONT></FONT></P></TD>
<TD vAlign=top width=240>
<P><FONT size=1><FONT color=#000000><SPAN style="FONT-FAMILY: 宋体">时间戳的明文</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">,</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体">由客户端产生</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">,</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体">格式为</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">MMDDHHMMSS</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体">，即月日时分秒，</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">10</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体">位数字的整型，右对齐</SPAN><FONT face="Times New Roman"> </FONT><SPAN style="FONT-FAMILY: 宋体">。</SPAN></FONT><SPAN lang=EN-US></SPAN></FONT></P></TD></TR></TBODY></TABLE></DIV>
<DIV>&nbsp;</DIV>
<DIV>根据上的定义我们可以写出的代码，如下，在VC环境下编写的</DIV>
<DIV><BR>/*<BR>&nbsp;*函数功能：建立和CMPP网关的直接通路<BR>&nbsp;*输入条件：SP用户名const char *UserName,SP密码const char *PWD&nbsp; <BR>&nbsp;*/</DIV>
<DIV>void Ccmpp_API::CmppConnect(const char *UserName, const char *PWD)<BR>{</DIV>
<DIV>&nbsp;char netbuf[100];<BR>&nbsp;CMPP_CONNECT *bufer;<BR>&nbsp;bufer=(CMPP_CONNECT*)netbuf;<BR>&nbsp;memset(bufer, 0, 100);</DIV>
<DIV>&nbsp;bufer-&gt;nTotalLength = htonl(39);//CMPP_CONNECT消息总长度<BR>&nbsp;bufer-&gt;nCommandId = htonl(CMPP_CONNECT_tag);//消息标志</DIV>
<DIV>&nbsp;//自动产生SeqId号<BR>&nbsp;&nbsp;&nbsp; if (sequenceid == 123456789i32)<BR>&nbsp;{<BR>&nbsp;&nbsp;sequenceid = 1;<BR>&nbsp;}else{<BR>&nbsp;&nbsp;sequenceid++;<BR>&nbsp;}<BR>&nbsp;bufer-&gt;nSeqId = htonl(sequenceid);<BR>&nbsp;&nbsp;&nbsp; <BR>&nbsp;int MD5Len;<BR>&nbsp;MD5_CTX md5;//MD5源字串<BR>&nbsp;CTime TimeData = CTime::GetCurrentTime();<BR>&nbsp;CString timestamp = TimeData.Format("%m%d%H%M%S");<BR>&nbsp;unsigned char md5source[29]; <BR>&nbsp;int Len1 = strlen(UserName);<BR>&nbsp;int Len2 = strlen(PWD);&nbsp;<BR>&nbsp;MD5Len = Len1 + 9 +Len2 + timestamp.GetLength();<BR>&nbsp;memset(md5source, 0, MD5Len);<BR>&nbsp;<BR>&nbsp;memcpy(bufer-&gt;sSourceAddr, UserName, Len1);<BR>&nbsp;memcpy(md5source, UserName, Len1);<BR>&nbsp;<BR>&nbsp;for (int j = 0; j&lt;Len2; j++)<BR>&nbsp;{<BR>&nbsp;&nbsp;md5source[j + Len1 + 9] = PWD[j];<BR>&nbsp;}</DIV>
<DIV>&nbsp;for (int i=0;i&lt;timestamp.GetLength();i++)<BR>&nbsp;{<BR>&nbsp;&nbsp;md5source[i + Len2 + Len1 + 9]=timestamp[i];<BR>&nbsp;}<BR>&nbsp;<BR>&nbsp;//进行md5加密转换<BR>&nbsp;md5.MD5Update(md5source, MD5Len);<BR>&nbsp;md5.MD5Final(md5source);<BR>&nbsp;memcpy(bufer-&gt;sAuthSource, md5source, 29);<BR>&nbsp;bufer-&gt;cVersion = 0x30;<BR>&nbsp;bufer-&gt;nTimeStamp = htonl(atoi(timestamp));<BR>&nbsp;CmppSocket.Send(bufer, 39, 0);//把消息打包发送<BR>&nbsp;return;<BR>}</DIV>
<DIV>&nbsp;</DIV>
<DIV>今天就到这，下次再写，欢迎交流！</DIV><img src ="http://www.cppblog.com/wangxiaoguang/aggbug/4160.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/wangxiaoguang/" target="_blank">炙热的太阳</a> 2006-03-15 07:58 <a href="http://www.cppblog.com/wangxiaoguang/archive/2006/03/15/4160.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>第一次写博文，希望得到大家支持与鼓励！</title><link>http://www.cppblog.com/wangxiaoguang/archive/2006/03/14/4138.html</link><dc:creator>炙热的太阳</dc:creator><author>炙热的太阳</author><pubDate>Tue, 14 Mar 2006 09:12:00 GMT</pubDate><guid>http://www.cppblog.com/wangxiaoguang/archive/2006/03/14/4138.html</guid><wfw:comment>http://www.cppblog.com/wangxiaoguang/comments/4138.html</wfw:comment><comments>http://www.cppblog.com/wangxiaoguang/archive/2006/03/14/4138.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/wangxiaoguang/comments/commentRss/4138.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/wangxiaoguang/services/trackbacks/4138.html</trackback:ping><description><![CDATA[&nbsp;&nbsp; <FONT size=2>什么都有第一次！第一次对谁来说都充满了神秘色彩，写博文与别人交谈，对我来说是第一次，也是一次新的尝试，所以就敲下这些文字，开始博客之旅！</FONT><img src ="http://www.cppblog.com/wangxiaoguang/aggbug/4138.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/wangxiaoguang/" target="_blank">炙热的太阳</a> 2006-03-14 17:12 <a href="http://www.cppblog.com/wangxiaoguang/archive/2006/03/14/4138.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>