﻿<?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++博客-Coffee in  Code out-文章分类-wxWidgets开发</title><link>http://www.cppblog.com/stonexin/category/15266.html</link><description /><language>zh-cn</language><lastBuildDate>Sat, 23 Oct 2010 20:44:18 GMT</lastBuildDate><pubDate>Sat, 23 Oct 2010 20:44:18 GMT</pubDate><ttl>60</ttl><item><title>[转]wxWidgets和QT之间的选择</title><link>http://www.cppblog.com/stonexin/articles/130996.html</link><dc:creator>xinst</dc:creator><author>xinst</author><pubDate>Sat, 23 Oct 2010 12:13:00 GMT</pubDate><guid>http://www.cppblog.com/stonexin/articles/130996.html</guid><wfw:comment>http://www.cppblog.com/stonexin/comments/130996.html</wfw:comment><comments>http://www.cppblog.com/stonexin/articles/130996.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/stonexin/comments/commentRss/130996.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/stonexin/services/trackbacks/130996.html</trackback:ping><description><![CDATA[<p>wxWidgets和QT之间的选择&nbsp; </p>
<p>&nbsp;&nbsp;&nbsp; 跨平台的C++ GUI工具库很多，可是应用广泛的也就那么几个，Qt、wxWidgets便是其中的翘楚。<br>&nbsp;&nbsp;&nbsp; 这里把GTK+排除在外，以C实现面向对象，上手相当困难，而且Windows平台下执行相当慢且不稳定。</p>
<p>&nbsp;&nbsp;&nbsp; Qt和wxWidgets各有各的优点，也各有各的缺点，各有各的适合应用点。<br>&nbsp;&nbsp;&nbsp; 工作环境和爱好限制，个人曾经分别使用过Qt和wxWidgets，<br>&nbsp;&nbsp;&nbsp; 到现在，就个人而言，选择在一般程序方向采用wxWidgets，在手机应用程序方向采用Qt。</p>
<p>&nbsp;&nbsp;&nbsp; 先说版权：<br>&nbsp;&nbsp;&nbsp; Qt，是芬兰的TrollTech公司研发的，现在属于Nokia，一直奉行的是双LICENSE策略，一个是商业版，一个是免费版：<br>&nbsp;&nbsp;&nbsp; 商业版的LICENSE就不说了，免费版的LICENSE，4.5版本之前一直采用GPL，意味着采用Qt的程序要么是商业软件，要么就是GPL软件，<br>&nbsp;&nbsp;&nbsp; 这就造成了虽然出了个著名的KDE，可惜应用范围还是受限，否则的话，应用应该更广阔点；<br>&nbsp;&nbsp;&nbsp; 不过还好，Nokia收购了之后意识到这个问题，4.5版本之后采用了LGPL，其他开发人员可以发布基于免费Qt库连接的商业软件了。<br>&nbsp;&nbsp;&nbsp; wxWidgets，一直奉行的是LGPL LICENSE。</p>
<p>&nbsp;&nbsp;&nbsp; 再评评各自的优缺点：<br>&nbsp;&nbsp;&nbsp; Qt，一直以来开发公司作为商业公司进行运作，以客户需求为目标，提供了一系列完整的文档和RAD工具，并提供最为完整的平台支持；<br>&nbsp;&nbsp;&nbsp; 对开发人员而言，Qt库本身，也是所有的GUI工具库中最为面向对象化的，同时也是最为稳定的。<br>&nbsp;&nbsp;&nbsp; 罗列一下：<br>&nbsp;&nbsp;&nbsp; Qt的优点：<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1. 支持的平台最多<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2. 商业化支持<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3. 完整的文档和RAD工具<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 4. 最为面向对象<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 5. 世界上最为成功的手机厂商支撑，对于移动终端的支持最为完善<br>&nbsp;&nbsp;&nbsp; Qt的缺点：<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1. 使用的是非标准C++<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2. 每个平台不是"Native GUI"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3. 过于庞大且运行缓慢<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 4. 与其它库不是很兼容（主要是STL之类的兼容问题）<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 5. 基本只能使用特定的qmake工具（其它工具经过良好的修改也可以，不过相当于重新编写一个qmake，是否值得）</p>
<p>&nbsp;&nbsp;&nbsp; wxWidgets，一直以来的LGPL发布，相当开放，积累了相当一部分研究用户，与现有各类工具库无缝连接地非常好；<br>&nbsp;&nbsp;&nbsp; 同时可惜的是没有非常强大的正规商业化运作，可靠性、资源丰富性远比不上Qt。<br>&nbsp;&nbsp;&nbsp; 还是罗列一下：<br>&nbsp;&nbsp;&nbsp; wxWidgets的优点：<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1. 开放，对于各类第三方库的良好兼容（TAO工具中的Naming_Service Viewer就是采用wxWidgets的）<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2. 支持各平台的"Native GUI"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3. 虽然有庞大的库，运行效果极为显著<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 4. 对各类现有工具的支持（笔者就采用MPC一站式产生所有项目的编译工程）<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 5. 偏MFC，对于Windows平台MFC程序的跨平台迁移，具有天然的优势<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 6. XRC，则提供了代码和设计分离的便利，程序员专注整体开发，UI设计群体则提供运行期界面、多语言版本支持功能等<br>&nbsp;&nbsp;&nbsp; wxWidgets的缺点：<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1. 由于是偏MFC，则面向对象封装做得不是非常好<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2. 相对缺乏的文档、资源<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3. 缺乏很好的商业化支持，如果商业软件出问题需要支持，稍微麻烦点</p>
<p>&nbsp;&nbsp;&nbsp; 总之：<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 在采用第三方工具库的复杂PC应用环境，有一定的底子，wxWidgets是不二的选择<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 在只需采用Qt单一工具库的应用环境，Qt是个不错的选择；特别是类似于手机这种嵌入式设备环境，由于Nokia的加入，Qt更值得一用。&nbsp; <br>&nbsp;<br>&nbsp;<br>&nbsp;<br></p>
<img src ="http://www.cppblog.com/stonexin/aggbug/130996.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/stonexin/" target="_blank">xinst</a> 2010-10-23 20:13 <a href="http://www.cppblog.com/stonexin/articles/130996.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[wxWidgets]Embedding PNG images into executables(将png嵌入到程序中)</title><link>http://www.cppblog.com/stonexin/articles/102520.html</link><dc:creator>xinst</dc:creator><author>xinst</author><pubDate>Fri, 04 Dec 2009 03:07:00 GMT</pubDate><guid>http://www.cppblog.com/stonexin/articles/102520.html</guid><wfw:comment>http://www.cppblog.com/stonexin/comments/102520.html</wfw:comment><comments>http://www.cppblog.com/stonexin/articles/102520.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/stonexin/comments/commentRss/102520.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/stonexin/services/trackbacks/102520.html</trackback:ping><description><![CDATA[<p>首先需要用工具将png图片转成.cpp或者.h文件<br>工具：<span class=mw-headline>bin2c <br>源代码：<br></span></p>
<div style="BORDER-BOTTOM: #cccccc 1px solid; BORDER-LEFT: #cccccc 1px solid; PADDING-BOTTOM: 4px; BACKGROUND-COLOR: #eeeeee; PADDING-LEFT: 4px; WIDTH: 98%; PADDING-RIGHT: 5px; FONT-SIZE: 13px; WORD-BREAK: break-all; BORDER-TOP: #cccccc 1px solid; BORDER-RIGHT: #cccccc 1px solid; PADDING-TOP: 4px"><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><span style="COLOR: #008000">//</span><span style="COLOR: #008000">&nbsp;bin2c.c<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">&nbsp;convert&nbsp;a&nbsp;binary&nbsp;file&nbsp;into&nbsp;a&nbsp;C&nbsp;source&nbsp;vector<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">&nbsp;THE&nbsp;"BEER-WARE&nbsp;LICENSE"&nbsp;(Revision&nbsp;3.1415):<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">&nbsp;sandro&nbsp;AT&nbsp;sigala&nbsp;DOT&nbsp;it&nbsp;wrote&nbsp;this&nbsp;file.&nbsp;As&nbsp;long&nbsp;as&nbsp;you&nbsp;retain&nbsp;this&nbsp;notice&nbsp;you&nbsp;can&nbsp;do<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">&nbsp;whatever&nbsp;you&nbsp;want&nbsp;with&nbsp;this&nbsp;stuff.&nbsp;&nbsp;If&nbsp;we&nbsp;meet&nbsp;some&nbsp;day,&nbsp;and&nbsp;you&nbsp;think&nbsp;this&nbsp;stuff&nbsp;is<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">&nbsp;worth&nbsp;it,&nbsp;you&nbsp;can&nbsp;buy&nbsp;me&nbsp;a&nbsp;beer&nbsp;in&nbsp;return.&nbsp;&nbsp;Sandro&nbsp;Sigala<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">&nbsp;syntax:&nbsp;&nbsp;bin2c&nbsp;[-c]&nbsp;[-z]&nbsp;&lt;input_file&gt;&nbsp;&lt;output_file&gt;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-c&nbsp;&nbsp;&nbsp;&nbsp;add&nbsp;the&nbsp;"const"&nbsp;keyword&nbsp;to&nbsp;definition<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-z&nbsp;&nbsp;&nbsp;&nbsp;terminate&nbsp;the&nbsp;array&nbsp;with&nbsp;a&nbsp;zero&nbsp;(useful&nbsp;for&nbsp;embedded&nbsp;C&nbsp;strings)<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">&nbsp;examples:<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bin2c&nbsp;-c&nbsp;myimage.png&nbsp;myimage_png.cpp<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bin2c&nbsp;-z&nbsp;sometext.txt&nbsp;sometext_txt.cpp</span><span style="COLOR: #008000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">#include&nbsp;</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">ctype.h</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">#include&nbsp;</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">stdio.h</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">#include&nbsp;</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">stdlib.h</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">#include&nbsp;</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000">.h</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">#ifndef&nbsp;PATH_MAX<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">#define</span><span style="COLOR: #000000">&nbsp;PATH_MAX&nbsp;1024</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">#endif</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;useconst&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;zeroterminated&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;myfgetc(FILE&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">f)<br><img id=Codehighlighter1_845_950_Open_Image onclick="this.style.display='none'; Codehighlighter1_845_950_Open_Text.style.display='none'; Codehighlighter1_845_950_Closed_Image.style.display='inline'; Codehighlighter1_845_950_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_845_950_Closed_Image onclick="this.style.display='none'; Codehighlighter1_845_950_Closed_Text.style.display='none'; Codehighlighter1_845_950_Open_Image.style.display='inline'; Codehighlighter1_845_950_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif"></span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_845_950_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_845_950_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;c&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;fgetc(f);<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">&nbsp;(c&nbsp;</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">&nbsp;EOF&nbsp;</span><span style="COLOR: #000000">&amp;&amp;</span><span style="COLOR: #000000">&nbsp;zeroterminated)<br><img id=Codehighlighter1_900_937_Open_Image onclick="this.style.display='none'; Codehighlighter1_900_937_Open_Text.style.display='none'; Codehighlighter1_900_937_Closed_Image.style.display='inline'; Codehighlighter1_900_937_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_900_937_Closed_Image onclick="this.style.display='none'; Codehighlighter1_900_937_Closed_Text.style.display='none'; Codehighlighter1_900_937_Open_Image.style.display='inline'; Codehighlighter1_900_937_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_900_937_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_900_937_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;zeroterminated&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">&nbsp;c;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockEnd.gif">}</span></span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000">&nbsp;process(</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">char</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">ifname,&nbsp;</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">char</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">ofname)<br><img id=Codehighlighter1_1006_1895_Open_Image onclick="this.style.display='none'; Codehighlighter1_1006_1895_Open_Text.style.display='none'; Codehighlighter1_1006_1895_Closed_Image.style.display='inline'; Codehighlighter1_1006_1895_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_1006_1895_Closed_Image onclick="this.style.display='none'; Codehighlighter1_1006_1895_Closed_Text.style.display='none'; Codehighlighter1_1006_1895_Open_Image.style.display='inline'; Codehighlighter1_1006_1895_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif"></span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_1006_1895_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_1006_1895_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;FILE&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">ifile,&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">ofile;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;errno_t&nbsp;err&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;fopen_s(</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">ifile,ifname,</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">rb</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">&nbsp;(ifile&nbsp;</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">&nbsp;NULL)<br><img id=Codehighlighter1_1095_1169_Open_Image onclick="this.style.display='none'; Codehighlighter1_1095_1169_Open_Text.style.display='none'; Codehighlighter1_1095_1169_Closed_Image.style.display='inline'; Codehighlighter1_1095_1169_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_1095_1169_Closed_Image onclick="this.style.display='none'; Codehighlighter1_1095_1169_Closed_Text.style.display='none'; Codehighlighter1_1095_1169_Open_Image.style.display='inline'; Codehighlighter1_1095_1169_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_1095_1169_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_1095_1169_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fprintf(stderr,&nbsp;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">cannot&nbsp;open&nbsp;%s&nbsp;for&nbsp;reading\n</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,&nbsp;ifname);<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;exit(</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">);<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;fopen_s(</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">ofile,ofname,&nbsp;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">wb</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">&nbsp;(ofile&nbsp;</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">&nbsp;NULL)<br><img id=Codehighlighter1_1223_1297_Open_Image onclick="this.style.display='none'; Codehighlighter1_1223_1297_Open_Text.style.display='none'; Codehighlighter1_1223_1297_Closed_Image.style.display='inline'; Codehighlighter1_1223_1297_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_1223_1297_Closed_Image onclick="this.style.display='none'; Codehighlighter1_1223_1297_Closed_Text.style.display='none'; Codehighlighter1_1223_1297_Open_Image.style.display='inline'; Codehighlighter1_1223_1297_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_1223_1297_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_1223_1297_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fprintf(stderr,&nbsp;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">cannot&nbsp;open&nbsp;%s&nbsp;for&nbsp;writing\n</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,&nbsp;ofname);<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;exit(</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">);<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">char</span><span style="COLOR: #000000">&nbsp;buf[PATH_MAX],&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">p;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">char</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">cp;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">&nbsp;((cp&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;strrchr(ifname,&nbsp;</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">))&nbsp;</span><span style="COLOR: #000000">!=</span><span style="COLOR: #000000">&nbsp;NULL)<br><img id=Codehighlighter1_1384_1395_Open_Image onclick="this.style.display='none'; Codehighlighter1_1384_1395_Open_Text.style.display='none'; Codehighlighter1_1384_1395_Closed_Image.style.display='inline'; Codehighlighter1_1384_1395_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_1384_1395_Closed_Image onclick="this.style.display='none'; Codehighlighter1_1384_1395_Closed_Text.style.display='none'; Codehighlighter1_1384_1395_Open_Image.style.display='inline'; Codehighlighter1_1384_1395_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_1384_1395_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_1384_1395_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">cp;<br><img id=Codehighlighter1_1402_1483_Open_Image onclick="this.style.display='none'; Codehighlighter1_1402_1483_Open_Text.style.display='none'; Codehighlighter1_1402_1483_Closed_Image.style.display='inline'; Codehighlighter1_1402_1483_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_1402_1483_Closed_Image onclick="this.style.display='none'; Codehighlighter1_1402_1483_Closed_Text.style.display='none'; Codehighlighter1_1402_1483_Open_Image.style.display='inline'; Codehighlighter1_1402_1483_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">else</span><span style="COLOR: #000000">&nbsp;</span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_1402_1483_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_1402_1483_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">&nbsp;((cp&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;strrchr(ifname,&nbsp;</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">\\</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">))&nbsp;</span><span style="COLOR: #000000">!=</span><span style="COLOR: #000000">&nbsp;NULL)<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">cp;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">else</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cp&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;ifname;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;strcpy_s(buf,&nbsp;cp);<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">&nbsp;(p&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;buf;&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">p&nbsp;</span><span style="COLOR: #000000">!=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">\0</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">;&nbsp;</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">p)<br><img id=Codehighlighter1_1539_1575_Open_Image onclick="this.style.display='none'; Codehighlighter1_1539_1575_Open_Text.style.display='none'; Codehighlighter1_1539_1575_Closed_Image.style.display='inline'; Codehighlighter1_1539_1575_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_1539_1575_Closed_Image onclick="this.style.display='none'; Codehighlighter1_1539_1575_Closed_Text.style.display='none'; Codehighlighter1_1539_1575_Open_Image.style.display='inline'; Codehighlighter1_1539_1575_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_1539_1575_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_1539_1575_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">&nbsp;(</span><span style="COLOR: #000000">!</span><span style="COLOR: #000000">isalnum(</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">p))<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">p&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">_</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;fprintf(ofile,&nbsp;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">static&nbsp;%sunsigned&nbsp;char&nbsp;%s[]&nbsp;=&nbsp;{\n</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,&nbsp;useconst&nbsp;</span><span style="COLOR: #000000">?</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">const&nbsp;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">&nbsp;:&nbsp;</span><span style="COLOR: #000000">""</span><span style="COLOR: #000000">,&nbsp;buf);<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;c,&nbsp;col&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000">&nbsp;((c&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;myfgetc(ifile))&nbsp;</span><span style="COLOR: #000000">!=</span><span style="COLOR: #000000">&nbsp;EOF)<br><img id=Codehighlighter1_1718_1831_Open_Image onclick="this.style.display='none'; Codehighlighter1_1718_1831_Open_Text.style.display='none'; Codehighlighter1_1718_1831_Closed_Image.style.display='inline'; Codehighlighter1_1718_1831_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_1718_1831_Closed_Image onclick="this.style.display='none'; Codehighlighter1_1718_1831_Closed_Text.style.display='none'; Codehighlighter1_1718_1831_Open_Image.style.display='inline'; Codehighlighter1_1718_1831_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_1718_1831_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_1718_1831_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">&nbsp;(col&nbsp;</span><span style="COLOR: #000000">&gt;=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">78</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">6</span><span style="COLOR: #000000">)<br><img id=Codehighlighter1_1743_1783_Open_Image onclick="this.style.display='none'; Codehighlighter1_1743_1783_Open_Text.style.display='none'; Codehighlighter1_1743_1783_Closed_Image.style.display='inline'; Codehighlighter1_1743_1783_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_1743_1783_Closed_Image onclick="this.style.display='none'; Codehighlighter1_1743_1783_Closed_Text.style.display='none'; Codehighlighter1_1743_1783_Open_Image.style.display='inline'; Codehighlighter1_1743_1783_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_1743_1783_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_1743_1783_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fputc(</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">\n</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">,&nbsp;ofile);<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;col&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fprintf(ofile,&nbsp;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">0x%.2x,&nbsp;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,&nbsp;c);<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;col&nbsp;</span><span style="COLOR: #000000">+=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">6</span><span style="COLOR: #000000">;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;fprintf(ofile,&nbsp;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">\n};\n</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;fclose(ifile);<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;fclose(ofile);<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockEnd.gif">}</span></span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000">&nbsp;usage(</span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000">)<br><img id=Codehighlighter1_1915_1997_Open_Image onclick="this.style.display='none'; Codehighlighter1_1915_1997_Open_Text.style.display='none'; Codehighlighter1_1915_1997_Closed_Image.style.display='inline'; Codehighlighter1_1915_1997_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_1915_1997_Closed_Image onclick="this.style.display='none'; Codehighlighter1_1915_1997_Closed_Text.style.display='none'; Codehighlighter1_1915_1997_Open_Image.style.display='inline'; Codehighlighter1_1915_1997_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif"></span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_1915_1997_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_1915_1997_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;fprintf(stderr,&nbsp;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">usage:&nbsp;bin2c&nbsp;[-cz]&nbsp;&lt;input_file&gt;&nbsp;&lt;output_file&gt;\n</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;exit(</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">);<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockEnd.gif">}</span></span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;main(</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;argc,&nbsp;</span><span style="COLOR: #0000ff">char</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">**</span><span style="COLOR: #000000">argv)<br><img id=Codehighlighter1_2032_2316_Open_Image onclick="this.style.display='none'; Codehighlighter1_2032_2316_Open_Text.style.display='none'; Codehighlighter1_2032_2316_Closed_Image.style.display='inline'; Codehighlighter1_2032_2316_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_2032_2316_Closed_Image onclick="this.style.display='none'; Codehighlighter1_2032_2316_Closed_Text.style.display='none'; Codehighlighter1_2032_2316_Open_Image.style.display='inline'; Codehighlighter1_2032_2316_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif"></span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_2032_2316_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_2032_2316_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000">&nbsp;(argc&nbsp;</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">3</span><span style="COLOR: #000000">)<br><img id=Codehighlighter1_2053_2242_Open_Image onclick="this.style.display='none'; Codehighlighter1_2053_2242_Open_Text.style.display='none'; Codehighlighter1_2053_2242_Closed_Image.style.display='inline'; Codehighlighter1_2053_2242_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_2053_2242_Closed_Image onclick="this.style.display='none'; Codehighlighter1_2053_2242_Closed_Text.style.display='none'; Codehighlighter1_2053_2242_Open_Image.style.display='inline'; Codehighlighter1_2053_2242_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_2053_2242_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_2053_2242_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">&nbsp;(</span><span style="COLOR: #000000">!</span><span style="COLOR: #000000">strcmp(argv[</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">],&nbsp;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">-c</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">))<br><img id=Codehighlighter1_2087_2130_Open_Image onclick="this.style.display='none'; Codehighlighter1_2087_2130_Open_Text.style.display='none'; Codehighlighter1_2087_2130_Closed_Image.style.display='inline'; Codehighlighter1_2087_2130_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_2087_2130_Closed_Image onclick="this.style.display='none'; Codehighlighter1_2087_2130_Closed_Text.style.display='none'; Codehighlighter1_2087_2130_Open_Image.style.display='inline'; Codehighlighter1_2087_2130_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_2087_2130_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_2087_2130_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;useconst&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #000000">--</span><span style="COLOR: #000000">argc;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">argv;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">else</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">&nbsp;(</span><span style="COLOR: #000000">!</span><span style="COLOR: #000000">strcmp(argv[</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">],&nbsp;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">-z</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">))<br><img id=Codehighlighter1_2167_2216_Open_Image onclick="this.style.display='none'; Codehighlighter1_2167_2216_Open_Text.style.display='none'; Codehighlighter1_2167_2216_Closed_Image.style.display='inline'; Codehighlighter1_2167_2216_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_2167_2216_Closed_Image onclick="this.style.display='none'; Codehighlighter1_2167_2216_Closed_Text.style.display='none'; Codehighlighter1_2167_2216_Open_Image.style.display='inline'; Codehighlighter1_2167_2216_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_2167_2216_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_2167_2216_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;zeroterminated&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #000000">--</span><span style="COLOR: #000000">argc;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">argv;<br><img id=Codehighlighter1_2223_2239_Open_Image onclick="this.style.display='none'; Codehighlighter1_2223_2239_Open_Text.style.display='none'; Codehighlighter1_2223_2239_Closed_Image.style.display='inline'; Codehighlighter1_2223_2239_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_2223_2239_Closed_Image onclick="this.style.display='none'; Codehighlighter1_2223_2239_Closed_Text.style.display='none'; Codehighlighter1_2223_2239_Open_Image.style.display='inline'; Codehighlighter1_2223_2239_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">else</span><span style="COLOR: #000000">&nbsp;</span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_2223_2239_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_2223_2239_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;usage();<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">&nbsp;(argc&nbsp;</span><span style="COLOR: #000000">!=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">3</span><span style="COLOR: #000000">)<br><img id=Codehighlighter1_2261_2275_Open_Image onclick="this.style.display='none'; Codehighlighter1_2261_2275_Open_Text.style.display='none'; Codehighlighter1_2261_2275_Closed_Image.style.display='inline'; Codehighlighter1_2261_2275_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_2261_2275_Closed_Image onclick="this.style.display='none'; Codehighlighter1_2261_2275_Closed_Text.style.display='none'; Codehighlighter1_2261_2275_Open_Image.style.display='inline'; Codehighlighter1_2261_2275_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_2261_2275_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_2261_2275_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;usage();<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;process(argv[</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">],&nbsp;argv[</span><span style="COLOR: #000000">2</span><span style="COLOR: #000000">]);<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockEnd.gif">}</span></span></div>
<p>在官方论坛中的做了些修改。去掉了一些警告信息。<br><br>2、在你的程序中包含转换好的cpp或者h<br>&nbsp;#include &lt;myimage_png.cpp&gt;<br><br>wxMemoryInputStream istream(myimage_png, sizeof myimage_png);<br>wxImage myimage_img(istream, wxBITMAP_TYPE_PNG);<br><br>或者可以定义个宏</p>
<pre>#define wxGetBitmapFromMemory(name) _wxGetBitmapFromMemory(name ## _png, sizeof(name ## _png))
inline wxBitmap _wxGetBitmapFromMemory(const unsigned char *data, int length) {
wxMemoryInputStream is(data, length);
return wxBitmap(wxImage(is, wxBITMAP_TYPE_ANY, -1), -1);
}
</pre>
<pre>注意：要确保png的句柄初始化了。wxImage::AddHandler(new wxPNGHandler);
<br></pre>
<img src ="http://www.cppblog.com/stonexin/aggbug/102520.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/stonexin/" target="_blank">xinst</a> 2009-12-04 11:07 <a href="http://www.cppblog.com/stonexin/articles/102520.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>