﻿<?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++博客-socketref-随笔分类-OpenSource开源工程</title><link>http://www.cppblog.com/socketref/category/6603.html</link><description>opensource in my life!
Technical Engineer</description><language>zh-cn</language><lastBuildDate>Thu, 03 Jul 2008 20:55:07 GMT</lastBuildDate><pubDate>Thu, 03 Jul 2008 20:55:07 GMT</pubDate><ttl>60</ttl><item><title>btsc 代码更新 串行数据协议传输，增加明文 CRC校验</title><link>http://www.cppblog.com/socketref/archive/2008/07/04/55285.html</link><dc:creator>放屁啊狗</dc:creator><author>放屁啊狗</author><pubDate>Thu, 03 Jul 2008 18:35:00 GMT</pubDate><guid>http://www.cppblog.com/socketref/archive/2008/07/04/55285.html</guid><wfw:comment>http://www.cppblog.com/socketref/comments/55285.html</wfw:comment><comments>http://www.cppblog.com/socketref/archive/2008/07/04/55285.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/socketref/comments/commentRss/55285.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/socketref/services/trackbacks/55285.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;2&nbsp;/*&nbsp;&nbsp;3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;name:&nbsp;&nbsp;&n...&nbsp;&nbsp;<a href='http://www.cppblog.com/socketref/archive/2008/07/04/55285.html'>阅读全文</a><img src ="http://www.cppblog.com/socketref/aggbug/55285.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/socketref/" target="_blank">放屁啊狗</a> 2008-07-04 02:35 <a href="http://www.cppblog.com/socketref/archive/2008/07/04/55285.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>hpux/solaris/win32 的openview NNM开发(与nnm通信)Mrtg</title><link>http://www.cppblog.com/socketref/archive/2008/07/04/55284.html</link><dc:creator>放屁啊狗</dc:creator><author>放屁啊狗</author><pubDate>Thu, 03 Jul 2008 17:50:00 GMT</pubDate><guid>http://www.cppblog.com/socketref/archive/2008/07/04/55284.html</guid><wfw:comment>http://www.cppblog.com/socketref/comments/55284.html</wfw:comment><comments>http://www.cppblog.com/socketref/archive/2008/07/04/55284.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/socketref/comments/commentRss/55284.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/socketref/services/trackbacks/55284.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->&nbsp;&nbsp;1&nbsp;/**&nbsp;&nbsp;2&nbsp;2005.10.13&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sco...&nbsp;&nbsp;<a href='http://www.cppblog.com/socketref/archive/2008/07/04/55284.html'>阅读全文</a><img src ="http://www.cppblog.com/socketref/aggbug/55284.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/socketref/" target="_blank">放屁啊狗</a> 2008-07-04 01:50 <a href="http://www.cppblog.com/socketref/archive/2008/07/04/55284.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>操作Solid 数据库代码</title><link>http://www.cppblog.com/socketref/archive/2008/07/04/55283.html</link><dc:creator>放屁啊狗</dc:creator><author>放屁啊狗</author><pubDate>Thu, 03 Jul 2008 17:39:00 GMT</pubDate><guid>http://www.cppblog.com/socketref/archive/2008/07/04/55283.html</guid><wfw:comment>http://www.cppblog.com/socketref/comments/55283.html</wfw:comment><comments>http://www.cppblog.com/socketref/archive/2008/07/04/55283.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/socketref/comments/commentRss/55283.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/socketref/services/trackbacks/55283.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: solid数据可能听说过的人不多，可是很多unix软件很多都采用此数据库，其儿紧凑，也是不大常见所以也能操持其稳定吧当初为了操作这个东东也是费了好些时候，主要是要申请到solid的sdk包 libsolidsa.a有了当然好办了，当然没有的可以联系我Code highlighting produced by Actipro CodeHighlighter (freeware)http://ww...&nbsp;&nbsp;<a href='http://www.cppblog.com/socketref/archive/2008/07/04/55283.html'>阅读全文</a><img src ="http://www.cppblog.com/socketref/aggbug/55283.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/socketref/" target="_blank">放屁啊狗</a> 2008-07-04 01:39 <a href="http://www.cppblog.com/socketref/archive/2008/07/04/55283.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>python连接DB2</title><link>http://www.cppblog.com/socketref/archive/2008/07/04/55281.html</link><dc:creator>放屁啊狗</dc:creator><author>放屁啊狗</author><pubDate>Thu, 03 Jul 2008 17:28:00 GMT</pubDate><guid>http://www.cppblog.com/socketref/archive/2008/07/04/55281.html</guid><wfw:comment>http://www.cppblog.com/socketref/comments/55281.html</wfw:comment><comments>http://www.cppblog.com/socketref/archive/2008/07/04/55281.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/socketref/comments/commentRss/55281.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/socketref/services/trackbacks/55281.html</trackback:ping><description><![CDATA[公司的项目中有访问DB2数据的需求，我以前也只是听说DB2有这么个咚咚，据说也是个恐龙级的数据库。以前也没有用过DB2 在c语言的接口(访问oracle我一直用oci),网上一兜，才发现DB2有JDBC的访问接口，c方面的很少。<br>项目的工期比较紧，同时我也不想花太多的时间研究数据库访问接口，所以在项目中许多模块都是用python编写，开发周期短，调试，跨平台也是很吸引人，所以就用python拉。在python.org一搜索，便找到了pydb2,OK! 马上下载pydb1.2，一解开压缩包，原来是原代码，只能编译拉。还好有编译脚本:), 运行setup.py install<br>出现以下异常:<br>Compiling under Visual Studio .NET v7 recieves the<br>following error: <br><br>_db2_module.c(1855) : error C2036: 'SQLPOINTER' :<br>unknown size<br><br>This can be resolved by casting to (SQLCHAR *) instead<br>of a (void *): <br><br>&lt; SQLPOINTER buf = (SQLPOINTER)((SQLCHAR<br>*)bs-&gt;buf + (bs-&gt;bufLen * idx));<br><br>发现原来SQLCHAR类型没有找到，没问题，找到_db2_module.c:1855行修改为：<br>SQLPOINTER buf = (SQLPOINTER)((void *)bs-&gt;buf +<br>(bs-&gt;bufLen * idx)); <br>再次 setup.py install<br>ok，编译成功，db2.py的模块也被拷贝得到 $PYTHONHOME/lib/site_pakages/下去了<br>然后安装db2 client runtime<br>这样就完成了pydb2的运行配置。然后就在odbc中配置一个dsn<br>测试以下代码：<br><br>import DB2<br>conn = DB2.connect(dsn='sample', uid='db2inst1', pwd='secret')<br>无异常表示成功连接上DB2<br>之后访问数据库只要遵循python DBI2.0的规范就可以拉！<br>生活在python世界是很快乐的事情！<br><br>*注意: python2.4的话必须用vc7.1编译pydb2的扩展模块，因为python2.4(win32)也是用vc7.1编译的<br><br><br><br><img src ="http://www.cppblog.com/socketref/aggbug/55281.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/socketref/" target="_blank">放屁啊狗</a> 2008-07-04 01:28 <a href="http://www.cppblog.com/socketref/archive/2008/07/04/55281.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>cron介绍</title><link>http://www.cppblog.com/socketref/archive/2008/07/04/55280.html</link><dc:creator>放屁啊狗</dc:creator><author>放屁啊狗</author><pubDate>Thu, 03 Jul 2008 17:25:00 GMT</pubDate><guid>http://www.cppblog.com/socketref/archive/2008/07/04/55280.html</guid><wfw:comment>http://www.cppblog.com/socketref/comments/55280.html</wfw:comment><comments>http://www.cppblog.com/socketref/archive/2008/07/04/55280.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/socketref/comments/commentRss/55280.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/socketref/services/trackbacks/55280.html</trackback:ping><description><![CDATA[/sbin/service crond start &nbsp;&nbsp;&nbsp; //启动服务<br>/sbin/service crond stop &nbsp;&nbsp;&nbsp; //关闭服务<br>/sbin/service crond restart //重启服务<br>/sbin/service crond reload &nbsp;&nbsp;&nbsp; //重新载入配置<br><br>在/etc/rc.d/rc.local这个脚本的末尾加上：<br>/sbin/service crond start<br><br><br>1.直接用crontab命令编辑<br>cron服务提供crontab命令来设定cron服务的，以下是这个命令的一些参数与说明：<br>crontab -u //设定某个用户的cron服务，一般root用户在执行这个命令的时候需要此参数<br><br>crontab -l //列出某个用户cron服务的详细内容<br><br>crontab -r //删除没个用户的cron服务<br><br>crontab -e //编辑某个用户的cron服务<br><br>比如说root查看自己的cron设置：crontab -u root -l<br><br>再例如，root想删除fred的cron设置：crontab -u fred -r<br><br>在编辑cron服务时，编辑的内容有一些格式和约定，输入：crontab -u root -e<br><br>进入vi编辑模式，编辑的内容一定要符合下面的格式：*/1 * * * * ls &gt;&gt; /tmp/ls.txt<br><br>时间的设定我们有一定的约定，前面五个*号代表五个数字，数字的取值范围和含义如下：<br>分钟　（0-59）<br>小時　（0-23）<br>日期　（1-31）<br>月份　（1-12）<br>星期　（0-6）//0代表星期天<br><br>除了数字还有几个个特殊的符号就是"*"、"/"和"-"、","，*代表所有的取值范围内的数字，"/"代表每的意思,"*/5"表示每5个单位，"-"代表从某个数字到某个数字,","分开几个离散的数字。以下举几个例子说明问题：<br><br>每天早上6点<br><br>0 6 * * * echo "Good morning." &gt;&gt; /tmp/test.txt //注意单纯echo，从屏幕上看不到任何输出，因为cron把任何输出都email到root的信箱了。<br><br>每两个小时<br><br>0 */2 * * * echo "Have a break now." &gt;&gt; /tmp/test.txt<br><br>晚上11点到早上8点之间每两个小时，早上八点<br><br>0 23-7/2，8 * * * echo "Have a good dream：）" &gt;&gt; /tmp/test.txt<br><br>每个月的4号和每个礼拜的礼拜一到礼拜三的早上11点<br><br>0 11 4 * 1-3 command line<br><br>1月1日早上4点<br><br>0 4 1 1 * command line<br><br>每次编辑完某个用户的cron设置后，cron自动在/var/spool/cron下生成一个与此用户同名的文件，此用户的cron信息都记录在这个文件中，这个文件是不可以直接编辑的，只可以用crontab -e 来编辑。cron启动后每过一份钟读一次这个文件，检查是否要执行里面的命令。因此此文件修改后不需要重新启动cron服务。<br><br>2.编辑/etc/crontab 文件配置cron<br><br>cron 服务每分钟不仅要读一次/var/spool/cron内的所有文件，还需要读一次/etc/crontab,因此我们配置这个文件也能运用cron服务做一些事情。用crontab配置是针对某个用户的，而编辑/etc/crontab是针对系统的任务。此文件的文件格式是：<br><br>SHELL=/bin/bash<br>PATH=/sbin:/bin:/usr/sbin:/usr/bin<br>MAILTO=root //如果出现错误，或者有数据输出，数据作为邮件发给这个帐号<br>HOME=/ //使用者运行的路径,这里是根目录<br># run-parts<br>01 * * * * root run-parts /etc/cron.hourly //每小时执行/etc/cron.hourly内的脚本<br>02 4 * * * root run-parts /etc/cron.daily //每天执行/etc/cron.daily内的脚本<br>22 4 * * 0 root run-parts /etc/cron.weekly //每星期执行/etc/cron.weekly内的脚本<br>42 4 1 * * root run-parts /etc/cron.monthly //每月去执行/etc/cron.monthly内的脚本<br><br><br><img src ="http://www.cppblog.com/socketref/aggbug/55280.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/socketref/" target="_blank">放屁啊狗</a> 2008-07-04 01:25 <a href="http://www.cppblog.com/socketref/archive/2008/07/04/55280.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>WINCE 设置环境变量-系统加载路径</title><link>http://www.cppblog.com/socketref/archive/2008/07/04/55279.html</link><dc:creator>放屁啊狗</dc:creator><author>放屁啊狗</author><pubDate>Thu, 03 Jul 2008 17:24:00 GMT</pubDate><guid>http://www.cppblog.com/socketref/archive/2008/07/04/55279.html</guid><wfw:comment>http://www.cppblog.com/socketref/comments/55279.html</wfw:comment><comments>http://www.cppblog.com/socketref/archive/2008/07/04/55279.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/socketref/comments/commentRss/55279.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/socketref/services/trackbacks/55279.html</trackback:ping><description><![CDATA[{<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; TCHAR pText[] = _T("\\Windows\\0\\NandFlashPartition\\MediaLib\0\\Storage Card\\MediaLib\0\0");<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; CString strText(pText,sizeof(pText));<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; SaveMultString(HKEY_LOCAL_MACHINE,_T("Loader"),_T("SystemPath"),strText,sizeof(pText));<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; DeleteKey(HKEY_LOCAL_MACHINE,_T("SOFTWARE\\sample\\PLAY"));<br>&nbsp;&nbsp;&nbsp; }<br><img src ="http://www.cppblog.com/socketref/aggbug/55279.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/socketref/" target="_blank">放屁啊狗</a> 2008-07-04 01:24 <a href="http://www.cppblog.com/socketref/archive/2008/07/04/55279.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>cpio介绍</title><link>http://www.cppblog.com/socketref/archive/2008/07/04/55278.html</link><dc:creator>放屁啊狗</dc:creator><author>放屁啊狗</author><pubDate>Thu, 03 Jul 2008 17:23:00 GMT</pubDate><guid>http://www.cppblog.com/socketref/archive/2008/07/04/55278.html</guid><wfw:comment>http://www.cppblog.com/socketref/comments/55278.html</wfw:comment><comments>http://www.cppblog.com/socketref/archive/2008/07/04/55278.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/socketref/comments/commentRss/55278.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/socketref/services/trackbacks/55278.html</trackback:ping><description><![CDATA[cpio(copy in/out)<br><br>功能说明：备份文件。<br><br>语　　法：cpio [-0aABckLovV][-C &lt;输入/输出大小&gt;][-F &lt;备份档&gt;][-H &lt;备份格式&gt;][-O &lt;备份档&gt;][--block-size= &lt;区块大小&gt;][--force-local][--help][--quiet][--version] 或 cpio [- bBcdfikmnrsStuvV][-C &lt;输入/输出大小&gt;][-E &lt;范本文件&gt;][-F &lt;备份档&gt;][- H &lt;备份格式&gt;][-I &lt;备份档&gt;][-M &lt;回传信息&gt;][-R &lt;拥有者&gt;&lt;: /.&gt;&lt;所属群组&gt;][--block-size=&lt;区块大小&gt;][--force-local][--help][-- no-absolute-filenames][--no-preserve-owner][--only-verify-crc][--quiet][- -sparse][--version][范本样式...] 或 cpio [-0adkiLmpuvV][-R &lt;拥有者&gt;&lt;: /.&gt;&lt;所属群组&gt;][--help][--no-preserve-owner][--quiet][--sparse][-- version][目的目]<br><br>补充说明：cpio是用来建立，还原备份档的工具程序，它可以加入，解开cpio或tra备份档内的文件。<br><br>参　　数：<br>　-0或--null 　接受新增列控制字符，通常配合find指令的"-print0"参数使用。 <br>　-a或--reset-access-time 　重新设置文件的存取时间。 <br>　-A或--append 　附加到已存在的备份档中，且这个备份档必须存放在磁盘上，而不能放置于磁带机里。 <br>　-b或--swap 　此参数的效果和同时指定"-sS"参数相同。 <br>　-B 　将输入/输出的区块大小改成5210 Bytes。 <br>　-c 　使用旧ASCII备份格式。 <br>　-C&lt;区块大小&gt;或--io-size=&lt;区块大小&gt; 　设置输入/输出的区块大小，单位是Byte。 <br>　-d或--make-directories 　如有需要cpio会自行建立目录。 <br>　-E&lt;范本文件&gt;或--pattern-file=&lt;范本文件&gt; 　指定范本文件，其内含有一个或多个范本样式，让cpio解开符合范本条件的文件，格式为每列一个范本样式。 <br>　-f或--nonmatching 　让cpio解开所有不符合范本条件的文件。 <br>　-F&lt;备份档&gt;或--file=&lt;备份档&gt; 　指定备份档的名称，用来取代标准输入或输出，也能借此通过网络使用另一台主机的保存设备存取备份档。 <br>　-H&lt;备份格式&gt; 　指定备份时欲使用的文件格式。 <br>　-i或--extract 　执行copy-in模式，还原备份档。 <br>　-l&lt;备份档&gt; 　指定备份档的名称，用来取代标准输入，也能借此通过网络使用另一台主机的保存设备读取备份档。 <br>　-k 　此参数将忽略不予处理，仅负责解决cpio不同版本间的兼容性问题。 <br>　-l或--link 　以硬连接的方式取代复制文件，可在copy-pass模式下运用。 <br>　-L或--dereference 　不建立符号连接，直接复制该连接所指向的原始文件。 <br>　-m或preserve-modification-time 　不去更换文件的更改时间。 <br>　-M&lt;回传信息&gt;或--message=&lt;回传信息&gt; 　设置更换保存媒体的信息。 <br>　-n或--numeric-uid-gid 　使用"-tv"参数列出备份档的内容时，若再加上参数"-n"，则会以用户识别码和群组识别码替代拥有者和群组名称列出文件清单。 <br>　-o或--create 　执行copy-out模式，建立备份档。 <br>　-O&lt;备份档&gt; 　指定备份档的名称，用来取代标准输出，也能借此通过网络　使用另一台主机的保存设备存放备份档。 <br>　-p或--pass-through 　执行copy-pass模式，略过备份步骤，直接将文件复制到目的目录。 <br>　-r或--rename 　当有文件名称需要更动时，采用互动模式。 <br>　-R&lt;拥有者&gt;&lt;:/.&gt;&lt;所属群组&gt;或<br>　----owner&lt;拥有者&gt;&lt;:/.&gt;&lt;所属群组&gt; 　在copy-in模式还原备份档，或copy-pass模式复制文件时，可指定这些备份，复制的文件的拥有者与所属群组。 <br>　-s或--swap-bytes 　交换每对字节的内容。 <br>　-S或--swap-halfwords 　交换每半个字节的内容。 <br>　-t或--list 　将输入的内容呈现出来。 <br>　-u或--unconditional 　置换所有文件，不论日期时间的新旧与否，皆不予询问而直接覆盖。 <br>　-v或--verbose 　详细显示指令的执行过程。 <br>　-V或--dot 　执行指令时，在每个文件的执行程序前面加上"."号 <br>　--block-size=&lt;区块大小&gt; 　设置输入/输出的区块大小，假如设置数值为5，则区块大小为2500，若设置成10，则区块大小为5120，依次类推。 <br>　--force-local 　强制将备份档存放在本地主机。 <br>　--help 　在线帮助。 <br>　--no-absolute-filenames 　使用相对路径建立文件名称。 <br>　--no-preserve-owner 　不保留文件的拥有者，谁解开了备份档，那些文件就归谁所有。 <br>　-only-verify-crc 　当备份档采用CRC备份格式时，可使用这项参数检查备份档内的每个文件是否正确无误。 <br>　--quiet 　不显示复制了多少区块。 <br>　--sparse 　倘若一个文件内含大量的连续0字节，则将此文件存成稀疏文件。 <br>　--version 　显示版本信息。<br><img src ="http://www.cppblog.com/socketref/aggbug/55278.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/socketref/" target="_blank">放屁啊狗</a> 2008-07-04 01:23 <a href="http://www.cppblog.com/socketref/archive/2008/07/04/55278.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>cvs简单操作</title><link>http://www.cppblog.com/socketref/archive/2008/07/04/55277.html</link><dc:creator>放屁啊狗</dc:creator><author>放屁啊狗</author><pubDate>Thu, 03 Jul 2008 17:22:00 GMT</pubDate><guid>http://www.cppblog.com/socketref/archive/2008/07/04/55277.html</guid><wfw:comment>http://www.cppblog.com/socketref/comments/55277.html</wfw:comment><comments>http://www.cppblog.com/socketref/archive/2008/07/04/55277.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/socketref/comments/commentRss/55277.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/socketref/services/trackbacks/55277.html</trackback:ping><description><![CDATA[cvs server<br>===================<br>1. cvs -d /path/cvsroot init<br>2. groupadd cvs<br>3. chgrp -R cvs /path/cvsroot<br>4. chmod -R ug+rxw /path/cvsroot<br>5. edit /etc/groups, add cvs-user to cvs group ( cvs:::scott,may)<br>6. edit /etc/services,add following line:<br>&nbsp;&nbsp;&nbsp; &nbsp;cvspserver&nbsp; ... 2401<br>7. create /etc/xinetd.d/cvspserver, add following text:<br>&nbsp;&nbsp;&nbsp; service cvspserver<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; disable = no<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; flags&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = REUSE<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; protocal&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = tcp<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; socket_type&nbsp;&nbsp;&nbsp;&nbsp; = stream<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; wait&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = no<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; user&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = root<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; server&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = /usr/bin/cvs<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; server_args&nbsp;&nbsp;&nbsp;&nbsp; = --allow-root=/home/cvsroot pserver<br>&nbsp;&nbsp;&nbsp; }<br>8. service restart xinetd<br><br>cvs client setting<br>===================<br>1. vi .bash_profile,add CVSROOT varaible<br>&nbsp;&nbsp;&nbsp; CVSROOT=:pserver:user@host#2401:/server/path/cvsroot<br>2. cvs login<br>3. cvs import -m="test"&nbsp; project vendor release_version<br>4. cvs checkout project&nbsp;&nbsp;&nbsp; <br><br><br><br><br><br><br>CVS环境初始化<br>============<br><br>环境设置：指定CVS库的路径CVSROOT<br>tcsh<br>setenv CVSROOT /path/to/cvsroot<br>bash<br>CVSROOT=/path/to/cvsroot ; export CVSROOT<br><br>后面还提到远程CVS服务器的设置：<br>CVSROOT=:ext:$USER@test.server.address#port:/path/to/cvsroot CVS_RSH=ssh; export CVSROOT CVS_RSH<br><br>初始化：CVS版本库的初始化。<br>cvs init<br><br>一个项目的首次导入<br>cvs import -m "write some comments here" project_name vendor_tag release_tag<br>执行后：会将所有源文件及目录导入到/path/to/cvsroot/project_name目录下<br>vender_tag: 开发商标记<br>release_tag: 版本发布标记<br><br>项目导出：将代码从CVS库里导出<br>cvs checkout project_name<br>cvs 将创建project_name目录，并将最新版本的源代码导出到相应目录中。这个checkout和Virvual SourceSafe中的check out不是一个概念，相对于Virvual SourceSafe的check out是cvs update， check in是cvs commit。<br><br>CVS的日常使用&nbsp; <br>=============<br><br>注意：第一次导出以后，就不是通过cvs checkout来同步文件了，而是要进入刚才cvs checkout project_name导出的project_name目录下进行具体文件的版本同步（添加，修改，删除）操作。<br><br>将文件同步到最新的版本：<br>cvs update<br>不制定文件名，cvs将同步所有子目录下的文件，也可以制定某个文件名/目录进行同步<br>cvs update file_name<br>最好每天开始工作前或将自己的工作导入到CVS库里前都要做一次，并养成&#8220;先同步 后修改&#8221;的习惯，和Virvual SourceSafe不同，CVS里没有文件锁定的概念，所有的冲突是在commit之前解决，如果你修改过程中，有其他人修改并commit到了CVS库中，CVS会通知你文件冲突，并自动将冲突部分用<br>&gt;&gt;&gt;&gt;&gt;&gt;<br>content on cvs server<br>&lt;&lt;&lt;&lt;&lt;&lt;<br>content in your file<br>&gt;&gt;&gt;&gt;&gt;&gt;<br>标记出来，由你确认冲突内容的取舍。<br>版本冲突一般是在多个人修改一个文件造成的，但这种项目管理上的问题不应该指望由CVS来解决。<br><br>确认修改写入到CVS库里：<br>cvs commit -m "write some comments here" file_name<br><br>注意：CVS的很多动作都是通过cvs commit进行最后确认并修改的，最好每次只修改一个文件。在确认的前，还需要用户填写修改注释，以帮助其他开发人员了解修改的原因。如果不用写-m "comments"而直接确认`cvs commit file_name` 的话，cvs会自动调用系统缺省的文字编辑器(一般是vi)要求你写入注释。<br>注释的质量很重要：所以不仅必须要写，而且必须写一些比较有意义的内容：以方便其他开发人员能够很好的理解<br>不好的注释，很难让其他的开发人员快速的理解：比如： -m "bug fixed" 甚至 -m ""<br>好的注释，甚至可以用中文: -m "在用户注册过程中加入了Email地址校验"<br><br>修改某个版本注释：每次只确认一个文件到CVS库里是一个很好的习惯，但难免有时候忘了指定文件名，把多个文件以同样注释commit到CVS库里了，以下命令可以允许你修改某个文件某个版本的注释：<br>cvs admin -m 1.3:"write some comments here" file_name<br><br>添加文件<br>创建好新文件后，比如：touch new_file<br>cvs add new_file<br>注意：对于图片，Word文档等非纯文本的项目，需要使用cvs add -b选项，否则有可能出现文件被破坏的情况<br>比如：cvs add -kb new_file.gif<br>然后确认修改并注释<br>cvs ci -m "write some comments here"<br><br>删除文件：<br>将某个源文件物理删除后，比如：rm file_name<br>cvs rm file_name<br>然后确认修改并注释<br>cvs ci -m "write some comments here"<br>以上面前2步合并的方法为：<br>cvs rm -f file_name<br>cvs ci -m "why delete file"<br><br>注意：很多cvs命令都有缩写形式：commit=&gt;ci; update=&gt;up; checkout=&gt;co; remove=&gt;rm;<br><br><br>添加目录：<br>cvs add dir_name<br><br>查看修改历史：cvs log file_name<br>cvs history file_name<br><br>查看当前文件不同版本的区别<br>cvs diff -r1.3 -r1.5 file_name<br>查看当前文件（可能已经修改了）和库中相应文件的区别<br>cvs diff file_name<br>cvs的web界面提供了更方便的定位文件修改和比较版本区别的方法，具体安装设置请看后面的cvsweb使用<br><br>正确的通过CVS恢复旧版本的方法：<br>如果用cvs update -r1.2 file.name<br>这个命令是给file.name加一个STICK TAG： "1.2" ，虽然你的本意只是想将它恢复到1.2版本<br>正确的恢复版本的方法是：cvs update -p -r1.2 file_name &gt;file_name<br>如果不小心已经加成STICK TAG的话：用cvs update -A 解决<br><br>移动文件：文件重命名<br>cvs里没有cvs move或cvs rename，因为这两个操作是先cvs remove old_file_name，然后cvs add new_file_name实现的。<br><br>删除，移动目录：<br>最方便的方法是让管理员直接移动，删除CVSROOT里相应目录（因为CVS一个项目下的子目录都是独立的，移动到$CVSROOT目录下都可以作为新的独立项目：好比一颗树，其实砍下任意一枝都能独立存活），对目录进行了修改后，要求其开发人员重新导出项目cvs checkout project_name 或者用cvs update -dP同步。<br><br>CVS Branch：项目多分支同步开发<br>=============================<br><br>确认版本里程碑：多个文件各自版本号不一样，项目到一定阶段，可以给所有文件统一指定一个阶段里程碑版本号，方便以后按照这个阶段里程碑版本号导出项目，同时也是项目的多个分支开发的基础。<br>cvs tag release_1_0<br><br>开始一个新的里程碑：<br>cvs commit -r 2 标记所有文件开始进入2.x的开发<br><br>注意：CVS里的revsion和软件包的发布版本可以没有直接的关系。但所有文件使用和发布版本一致的版本号比较有助于维护。<br><br>在开发项目的2.x版本的时候发现1.x有问题，但2.x又不敢用，则从先前标记的里程碑：release_1_0导出一个分支release_1_0_patch<br>cvs rtag -b -r release_1_0 release_1_0_patch proj_dir<br><br>一些人先在另外一个目录下导出release_1_0_patch这个分支：解决1.0中的紧急问题，<br>cvs checkout -r release_1_0_patch<br>而其他人员仍旧在项目的主干分支2.x上开发<br><br>在release_1_0_patch上修正错误后，标记一个1.0的错误修正版本号<br>cvs tag release_1_0_patch_1<br><br>如果2.0认为这些错误修改在2.0里也需要，也可以在2.0的开发目录下合并release_1_0_patch_1中的修改到当前代码中：<br>cvs update -j release_1_0_patch_1<br><br>CVS的远程认证：通过SSH远程访问CVS<br>================================<br><br>使用cvs本身的远程认证很麻烦,需要定义服务器和用户组，用户名，设置密码等，而且不安全，因此和系统本地帐号认证并通过SSH传输是比较好的办法，通过在客户机的/etc/profile里设置一下内容：<br>CVSROOT=:ext:$USER@test.server.address#port:/path/to/cvsroot CVS_RSH=ssh; export CVSROOT CVS_RSH<br>所有客户机所有本地用户都可以映射到CVS服务器相应同名帐号了。<br><br>如果CVS所在服务器的SSH端口不在缺省的22，或者和客户端与CVS服务器端SSH缺省端口不一致，有时候设置了：<br>:ext:$USER@test.server.address#port:/path/to/cvsroot <br><br>仍然不行，比如有以下错误信息：<br>ssh: test.server.address#port: Name or service not known<br>cvs [checkout aborted]: end of file from server (consult above messages if any)<br><br>解决的方法是做一个脚本指定端口转向（不能使用alias，会出找不到文件错误）：<br>创建一个/usr/bin/ssh_cvs文件：<br>#!/usr/bin/sh<br>/path/to/ssh -p 34567 "$@"<br>然后：chmod +x /usr/bin/ssh_cvs<br>并CVS_RSH=ssh_cvs; export CVS_RSH<br><br>注意：port是指相应服务器SSH的端口，不是cvs pserver的端口<br><br>CVSWEB：提高程序员比较文件修改效率<br>================================<br><br>CVSWEB就是CVS的WEB界面，可以大大提高程序员定位修改的效率:<br>使用的样例可以看：http://www.freebsd.org/cgi/cvsweb.cgi<br><br>CVSWEB的下载：CVSWEB从最初的版本已经演化出很多功能界面更丰富的版本，这个是个人感觉觉得安装设置比较方便的：<br>http://www.spaghetti-code.de/software/linux/cvsweb/<br><br>下载解包：<br>tar zxf cvsweb.tgz<br>把配置文件cvsweb.conf放到安全的地方（比如和apache的配置放在同一个目录下），<br>修改：cvsweb.cgi让CGI找到配置文件：<br>$config = $ENV{'CVSWEB_CONFIG'} || '/path/to/apache/conf/cvsweb.conf';<br><br>转到/path/to/apache/conf下并修改cvsweb.conf：<br><br>&nbsp;&nbsp; 1. 修改CVSROOT路径设置：<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; %CVSROOT = (<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'Development' =&gt; '/path/to/cvsroot', #&lt;==修改指向本地的CVSROOT<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; );<br>&nbsp;&nbsp; 2. 缺省不显示已经删除的文档：<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "hideattic" =&gt; "1",#&lt;==缺省不显示已经删除的文档<br>&nbsp;&nbsp; 3. 在配置文件cvsweb.conf中还可以定制页头的描述信息，你可以修改$long_intro成你需要的文字 <br><br>CVSWEB可不能随便开放给所有用户，因此需要使用WEB用户认证：<br>先生成 passwd:<br>/path/to/apache/bin/htpasswd -c cvsweb.passwd user<br><br>修改httpd.conf: 增加<br>&lt;Directory "/path/to/apache/cgi-bin/cvsweb/"&gt;<br>AuthName "CVS Authorization"<br>AuthType Basic<br>AuthUserFile /path/to/cvsweb.passwd<br>require valid-user<br>&lt;/Directory&gt;<br><br>CVS TAGS: who? when?<br>====================<br><br>将$Id$ 加在程序文件开头的注释里是一个很好的习惯，cvs能够自动解释更新其中的内容成：file_name version time user_name 的格式，比如：cvs_card.txt,v 1.1 2002/04/05 04:24:12 chedong Exp，可以这些信息了解文件的最后修改人和修改时间<br><br>几个常用的缺省文件：<br>default.php<br>&lt;?php<br>/*<br>* Copyright (c) 2002 Company Name.<br>* $Header$<br>*/<br><br>?&gt;<br><br>====================================<br>Default.java: 注意文件头一般注释用 /* 开始 JAVADOC注释用 /** 开始的区别<br>/*<br>* Copyright (c) 2002 Company Name.<br>* $Header$<br>*/<br><br>package com.netease;<br><br>import java.io;<br><br>/**<br>* comments here<br>*/<br>public class Default {<br>&nbsp;&nbsp;&nbsp; /**<br>&nbsp;&nbsp;&nbsp; *<br>&nbsp;&nbsp;&nbsp; * @param<br>&nbsp;&nbsp;&nbsp; * @return<br>&nbsp;&nbsp;&nbsp; */<br>&nbsp;&nbsp;&nbsp; public toString() {<br><br>&nbsp;&nbsp;&nbsp; }<br>}<br><br>====================================<br>default.pl:<br>#!/usr/bin/perl -w<br># Copyright (c) 2002 Company Name.<br># $Header$<br><br># file comments here<br><br>use strict;<br><br>CVS vs VSS　<br>===========<br><br>CVS没有文件锁定模式，VSS在check out同时，同时记录了文件被导出者锁定。<br><br>CVS是update commit， VSS是check out check in<br><br>在CVS中，标记自动更新功能缺省是打开的，这样也带来一个潜在的问题，就是不用-kb方式添加binary文件的话在cvs自动更新时可能会导致文件失效。<br><br>Virsual SourceSafe中这个功能称之为Keyword Explaination，缺省是关闭的，需要通过OPITION打开，并指定需要进行源文件关键词扫描的类型：*.txt,*.java,*.html...<br><br>对于Virsual SourceSafe和CVS都通用的TAG有：<br>$Header$<br>$Author$<br>$Date$<br>$Revision$<br><br>尽量使用通用的关键词保证代码在CVS和VSS都能方便的跟踪。<br><br>　 <br><img src ="http://www.cppblog.com/socketref/aggbug/55277.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/socketref/" target="_blank">放屁啊狗</a> 2008-07-04 01:22 <a href="http://www.cppblog.com/socketref/archive/2008/07/04/55277.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>【转】curl介绍</title><link>http://www.cppblog.com/socketref/archive/2008/07/04/55275.html</link><dc:creator>放屁啊狗</dc:creator><author>放屁啊狗</author><pubDate>Thu, 03 Jul 2008 17:21:00 GMT</pubDate><guid>http://www.cppblog.com/socketref/archive/2008/07/04/55275.html</guid><wfw:comment>http://www.cppblog.com/socketref/comments/55275.html</wfw:comment><comments>http://www.cppblog.com/socketref/archive/2008/07/04/55275.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/socketref/comments/commentRss/55275.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/socketref/services/trackbacks/55275.html</trackback:ping><description><![CDATA[curl是一个利用URL语法在命令行方式下工作的文件传输工具。它支持很多协议：FTP, FTPS, HTTP, HTTPS, GOPHER, TELNET, DICT, FILE 以及 LDAP。curl同样支持HTTPS认证，HTTP POST方法, HTTP PUT方法, FTP上传, kerberos认证, HTTP上传, 代理服务器, cookies, 用户名/密码认证, 下载文件断点续传, 上载文件断点续传, http代理服务器管道（ proxy tunneling）, 甚至它还支持IPv6, socks5代理服务器, 通过http代理服务器上传文件到FTP服务器等等，功能十分强大。Windows操作系统下的网络蚂蚁，网际快车(FlashGet)的功能它都可以做到。准确的说，curl支持文件的上传和下载，所以是一个综合传输工具，但是按照传统，用户习惯称curl为下载工具。<br>curl是瑞典curl组织开发的，您可以访问http://curl.haxx.se/获取它的源代码和相关说明。鉴于curl在Linux上的广泛使用，IBM在AIX Linux Toolbox的光盘中包含了这个软件，并且您可以访问IBM网站http://www-1.ibm.com/servers/aix/products/aixos/linux/altlic.html下载它。curl的最新版本是7.10.8，IBM网站上提供的版本为7.9.3。在AIX下的安装很简单，IBM网站上下载的rpm格式的包。<br>在http://curl.haxx.se/docs/，您可以下载到UNIX格式的man帮助，里面有详细的curl工具的使用说明。curl的用法为：curl [options] [URL...] 其中options是下载需要的参数，大约有80多个，curl的各个功能完全是依靠这些参数完成的。具体参数的使用，用户可以参考curl的man帮助。<br>下面，本文就将结合具体的例子来说明怎样利用curl进行下载。<br>1、获得一张页面<br>使用命令：curl http://curl.haxx.se<br>这是最简单的使用方法。用这个命令获得了http://curl.haxx.se指向的页面，同样，如果这里的URL指向的是一个文件或者一幅图都可以直接下载到本地。如果下载的是HTML文档，那么缺省的将不显示文件头部，即HTML文档的header。要全部显示，请加参数 -i，要只显示头部，用参数 -I。任何时候，可以使用 -v 命令看curl是怎样工作的，它向服务器发送的所有命令都会显示出来。为了断点续传，可以使用-r参数来指定传输范围。<br>2、表单（Form）的获取<br>在WEB页面设计中，form是很重要的元素。Form通常用来收集并向网站提交信息。提交信息的方法有两种，GET方法和POST方法。先讨论GET方法，例如在页面中有这样一段：<br>&lt;form method="GET" action="junk.cgi"&gt;<br>&lt;input type=text name="birthyear"&gt;<br>&lt;input type=submit name=press value="OK"&gt;<br>&lt;/form&gt;<br>那么浏览器上会出现一个文本框和一个标为&#8220;OK&#8221;的按钮。按下这个按钮，表单就用GET方法向服务器提交文本框的数据。例如原始页面是在www.hotmail.com/when/birth.html看到的，然后您在文本框中输入1905，然后按OK按钮，那么浏览器的URL现在应该是：&#8220;www.hotmail.com/when/junk.cgi?birthyear=1905&amp;press=OK&#8221;<br>对于这种网页，curl可以直接处理，例如想获取上面的网页，只要输入：<br>curl "www.hotmail.com/when/junk.cgi?birthyear=1905&amp;press=OK"<br>就可以了。<br>表单用来提交信息的第二种方法叫做POST方法，POST方法和GET方法的区别在于GET方法使用的时候，浏览器中会产生目标URL，而POST不会。类似GET，这里有一个网页：<br>&lt;form method="POST" action="junk.cgi"&gt;<br>&lt;input type=text name="birthyear"&gt;<br>&lt;input type=submit name=press value="OK"&gt;<br>&lt;/form&gt;<br>浏览器上也会出现一个文本框和一个标为&#8220;OK&#8221;的按钮。按下这个按钮，表单用POST方法向服务器提交数据。这时的URL是看不到的，因此需要使用特殊的方法来抓取这个页面：<br>curl -d "birthyear=1905&amp;press=OK" www.hotmail.com/when/junk.cgi<br>这个命令就可以做到。<br>1995年年末，RFC 1867定义了一种新的POST方法，用来上传文件。主要用于把本地文件上传到服务器。此时页面是这样写的：<br>&lt;form method="POST" enctype='multipart/form-data' action="upload.cgi"&gt;<br>&lt;input type=file name=upload&gt;<br>&lt;input type=submit name=press value="OK"&gt;<br>&lt;/form&gt;<br>对于这种页面，curl的用法不同：<br>curl -F upload=@localfilename -F press=OK [URL]<br>这个命令的实质是将本地的文件用POST上传到服务器。有关POST还有不少用法，用户可以自己摸索。<br>3、使用PUT方法。<br>HTTP协议文件上传的标准方法是使用PUT，此时curl命令使用-T参数：<br>curl -T uploadfile www.uploadhttp.com/receive.cgi<br>4、有关认证。<br>curl可以处理各种情况的认证页面，例如下载用户名/密码认证方式的页面（在IE中通常是出现一个输入用户名和密码的输入框）：<br>curl -u name:password www.secrets.com<br>如果网络是通过http代理服务器出去的，而代理服务器需要用户名和密码，那么输入：<br>curl -U proxyuser:proxypassword http://curl.haxx.se<br>任何需要输入用户名和密码的时候，只在参数中指定用户名而空着密码，curl可以交互式的让用户输入密码。<br>5、引用。<br>有些网络资源访问的时候必须经过另外一个网络地址跳转过去，这用术语来说是：referer，引用。对于这种地址的资源，curl也可以下载：<br>curl -e http://curl.haxx.se daniel.haxx.se<br>6、指定用户客户端。<br>有些网络资源首先需要判断用户使用的是什么浏览器，符合标准了才能够下载或者浏览。此时curl可以把自己&#8220;伪装&#8221;成任何其他浏览器：<br>curl -A "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)" [URL]<br>这个指令表示curl伪装成了IE5.0，用户平台是Windows 2000。（对方服务器是根据这个字串来判断客户端的类型的，所以即使使用AIX也无所谓）。使用：<br>curl -A "Mozilla/4.73 [en] (X11; U; Linux 2.2.15 i686)" [URL]<br>此时curl变成了Netscape，运行在PIII平台的Linux上了。<br>7、COOKIES<br>Cookie是服务器经常使用的一种记忆客户信息的方法。如果cookie被记录在了文件中，那么使用命令：<br>curl -b stored_cookies_in_file www.cookiesite.com<br>curl可以根据旧的cookie写出新cookie并发送到网站：<br>curl -b cookies.txt -c newcookies.txt www.cookiesite.com<br>8、加密的HTTP――HTTPS。<br>如果是通过OpenSSL加密的https协议传输的网页，curl可以直接访问：<br>curl https://that.secure.server.com<br>9、http认证。<br>如果是采用证书认证的http地址，证书在本地，那么curl这样使用：<br>curl -E mycert.pem https://that.secure.server.com<br><br>参考读物和注意事项：curl非常博大，用户要想使用好这个工具，除了详细学习参数之外，还需要深刻理解http的各种协议与URL的各个语法。这里推荐几个读物：<br>RFC 2616 HTTP协议语法的定义。<br>RFC 2396 URL语法的定义。<br>RFC 2109 Cookie是怎样工作的。<br>RFC 1867 HTTP如何POST，以及POST的格式。<br>curl是免费软件，IBM公司对curl不提供技术支持。<br><br><br><img src ="http://www.cppblog.com/socketref/aggbug/55275.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/socketref/" target="_blank">放屁啊狗</a> 2008-07-04 01:21 <a href="http://www.cppblog.com/socketref/archive/2008/07/04/55275.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>【转】wget介绍</title><link>http://www.cppblog.com/socketref/archive/2008/07/04/55276.html</link><dc:creator>放屁啊狗</dc:creator><author>放屁啊狗</author><pubDate>Thu, 03 Jul 2008 17:21:00 GMT</pubDate><guid>http://www.cppblog.com/socketref/archive/2008/07/04/55276.html</guid><wfw:comment>http://www.cppblog.com/socketref/comments/55276.html</wfw:comment><comments>http://www.cppblog.com/socketref/archive/2008/07/04/55276.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/socketref/comments/commentRss/55276.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/socketref/services/trackbacks/55276.html</trackback:ping><description><![CDATA[网络用户有时候会遇到需要下载一批文件的情况，有时甚至需要把整个网站下载下来或者制作网站的镜像。在Windows下的用户都比较熟悉Teleport，webzip等等网站下载工具，实际上AIX中也完全可以做到这样的功能，那就是利用wget工具。wget是一个命令行工具，用来下载网络文件或者整个网站，它具有自动重试、断点续传、支持代理服务器等等强大的功能。它可以完全替代ftp客户端。wget是在Linux下开发的开放源代码的软件，作者是Hrvoje Niksic，后来被移植到包括Windows在内的各个平台上。IBM在AIX Linux Toolbox中也提供了这个工具，使得它可以在AIX下运行。您可以在IBM网站http://www-1.ibm.com/servers/aix/products/aixos/linux/altlic.html下载到它。IBM提供的wget是1.8.1版本，rpm包格式的。<br>wget虽然功能强大，但是使用起来还是比较简单的，基本的语法是：wget [参数列表] URL。下面就结合具体的例子来说明一下wget的用法。<br>1、下载整个http或者ftp站点。<br>wget http://place.your.url/here<br>这个命令可以将http://place.your.url/here 首页下载下来。使用-x会强制建立服务器上一模一样的目录，如果使用-nd参数，那么服务器上下载的所有内容都会加到本地当前目录。<br>wget -r http://place.your.url/here<br>这个命令会按照递归的方法，下载服务器上所有的目录和文件，实质就是下载整个网站。这个命令一定要小心使用，因为在下载的时候，被下载网站指向的所有地址同样会被下载，因此，如果这个网站引用了其他网站，那么被引用的网站也会被下载下来！基于这个原因，这个参数不常用。可以用-l number参数来指定下载的层次。例如只下载两层，那么使用-l 2。<br>要是您想制作镜像站点，那么可以使用－m参数，例如：<br>wget -m http://place.your.url/here<br>这时wget会自动判断合适的参数来制作镜像站点。此时，wget会登录到服务器上，读入robots.txt并按robots.txt的规定来执行。<br>2、断点续传。<br>当文件特别大或者网络特别慢的时候，往往一个文件还没有下载完，连接就已经被切断，此时就需要断点续传。wget的断点续传是自动的，只需要使用-c参数，例如：<br>wget -c http://the.url.of/incomplete/file<br>使用断点续传要求服务器支持断点续传。-t参数表示重试次数，例如需要重试100次，那么就写-t 100，如果设成-t 0，那么表示无穷次重试，直到连接成功。-T参数表示超时等待时间，例如-T 120，表示等待120秒连接不上就算超时。<br>3、批量下载。<br>如果有多个文件需要下载，那么可以生成一个文件，把每个文件的URL写一行，例如生成文件download.txt，<br>然后用命令：<br>wget -i download.txt<br>这样就会把download.txt里面列出的每个URL都下载下来。（如果列的是文件就下载文件，如果列的是网站，那么下载首页）<br>4、选择性的下载。<br>可以指定让wget只下载一类文件，或者不下载什么文件。例如：<br>wget -m --reject=gif http://target.web.site/subdirectory<br>表示下载http://target.web.site/subdirectory，但是忽略gif文件。--accept=LIST 可以接受的文件类型，--reject=LIST拒绝接受的文件类型。<br>5、密码和认证。<br>wget只能处理利用用户名/密码方式限制访问的网站，可以利用两个参数：<br>--http-user=USER设置HTTP用户<br>--http-passwd=PASS设置HTTP密码<br>对于需要证书做认证的网站，就只能利用其他下载工具了，例如curl。<br>6、利用代理服务器进行下载。<br>如果用户的网络需要经过代理服务器，那么可以让wget通过代理服务器进行文件的下载。此时需要在当前用户的目录下创建一个.wgetrc文件。文件中可以设置代理服务器：<br>http-proxy = 111.111.111.111:8080<br>ftp-proxy = 111.111.111.111:8080<br>分别表示http的代理服务器和ftp的代理服务器。如果代理服务器需要密码则使用：<br>--proxy-user=USER设置代理用户<br>--proxy-passwd=PASS设置代理密码<br>这两个参数。<br>使用参数--proxy=on/off 使用或者关闭代理。<br>wget还有很多有用的功能，需要用户去挖掘。<br>备注：wget是免费软件，IBM公司不对wget提供软件维护和技术支持。<br><img src ="http://www.cppblog.com/socketref/aggbug/55276.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/socketref/" target="_blank">放屁啊狗</a> 2008-07-04 01:21 <a href="http://www.cppblog.com/socketref/archive/2008/07/04/55276.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>wxWidget的多语言</title><link>http://www.cppblog.com/socketref/archive/2008/07/04/55272.html</link><dc:creator>放屁啊狗</dc:creator><author>放屁啊狗</author><pubDate>Thu, 03 Jul 2008 17:19:00 GMT</pubDate><guid>http://www.cppblog.com/socketref/archive/2008/07/04/55272.html</guid><wfw:comment>http://www.cppblog.com/socketref/comments/55272.html</wfw:comment><comments>http://www.cppblog.com/socketref/archive/2008/07/04/55272.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/socketref/comments/commentRss/55272.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/socketref/services/trackbacks/55272.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: wxlocale 初始化字符语言种类&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; locale.Init(wxLANGUAGE_CHINESE );//&nbsp;&nbsp;&nbsp; locale.Init(wxLANGUAGE_FRENCH );&nbsp;&nbsp;&nbsp; wxLocale::AddCatalogLookupPathPrefix(wx...&nbsp;&nbsp;<a href='http://www.cppblog.com/socketref/archive/2008/07/04/55272.html'>阅读全文</a><img src ="http://www.cppblog.com/socketref/aggbug/55272.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/socketref/" target="_blank">放屁啊狗</a> 2008-07-04 01:19 <a href="http://www.cppblog.com/socketref/archive/2008/07/04/55272.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>【Linux Kernel】 读码时写的一些笔记，毕竟写给自己看，有些乱（好好理解kernel，能更好写出高效的驱动和应用代码）</title><link>http://www.cppblog.com/socketref/archive/2008/07/04/55271.html</link><dc:creator>放屁啊狗</dc:creator><author>放屁啊狗</author><pubDate>Thu, 03 Jul 2008 17:11:00 GMT</pubDate><guid>http://www.cppblog.com/socketref/archive/2008/07/04/55271.html</guid><wfw:comment>http://www.cppblog.com/socketref/comments/55271.html</wfw:comment><comments>http://www.cppblog.com/socketref/archive/2008/07/04/55271.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/socketref/comments/commentRss/55271.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/socketref/services/trackbacks/55271.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->bh处理1.三种旧式的bottom half 处理类型IMMEDIATE_BH:&nbsp; driver注册入tq_immediate队列，等待调度TQUEUE_BH: &nbsp;&n...&nbsp;&nbsp;<a href='http://www.cppblog.com/socketref/archive/2008/07/04/55271.html'>阅读全文</a><img src ="http://www.cppblog.com/socketref/aggbug/55271.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/socketref/" target="_blank">放屁啊狗</a> 2008-07-04 01:11 <a href="http://www.cppblog.com/socketref/archive/2008/07/04/55271.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>【Dos】汇编硬盘锁</title><link>http://www.cppblog.com/socketref/archive/2008/07/03/55263.html</link><dc:creator>放屁啊狗</dc:creator><author>放屁啊狗</author><pubDate>Thu, 03 Jul 2008 15:32:00 GMT</pubDate><guid>http://www.cppblog.com/socketref/archive/2008/07/03/55263.html</guid><wfw:comment>http://www.cppblog.com/socketref/comments/55263.html</wfw:comment><comments>http://www.cppblog.com/socketref/archive/2008/07/03/55263.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/socketref/comments/commentRss/55263.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/socketref/services/trackbacks/55263.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->&nbsp;&nbsp;硬盘锁&nbsp;HDD3.EXE&nbsp;&nbsp;&nbsp;程序:&nbsp;&nbsp;&nbsp;zbin&nbsp;&nbsp;&nbsp;&nbsp;1997-0...&nbsp;&nbsp;<a href='http://www.cppblog.com/socketref/archive/2008/07/03/55263.html'>阅读全文</a><img src ="http://www.cppblog.com/socketref/aggbug/55263.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/socketref/" target="_blank">放屁啊狗</a> 2008-07-03 23:32 <a href="http://www.cppblog.com/socketref/archive/2008/07/03/55263.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>【dos】将数据文件转化成MASM.EXE能编译的常量数据</title><link>http://www.cppblog.com/socketref/archive/2008/07/03/55259.html</link><dc:creator>放屁啊狗</dc:creator><author>放屁啊狗</author><pubDate>Thu, 03 Jul 2008 15:23:00 GMT</pubDate><guid>http://www.cppblog.com/socketref/archive/2008/07/03/55259.html</guid><wfw:comment>http://www.cppblog.com/socketref/comments/55259.html</wfw:comment><comments>http://www.cppblog.com/socketref/archive/2008/07/03/55259.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/socketref/comments/commentRss/55259.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/socketref/services/trackbacks/55259.html</trackback:ping><description><![CDATA[<div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; background-color: #eeeeee; font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: #008080;">&nbsp;1</span>&nbsp;<span style="color: #008000;">/*</span><span style="color: #008000;"><br></span><span style="color: #008080;">&nbsp;2</span>&nbsp;<span style="color: #008000;">&nbsp;&nbsp;&nbsp;&nbsp;将数据文件转化成MASM.EXE能编译的数据 98.zbin<br></span><span style="color: #008080;">&nbsp;3</span>&nbsp;<span style="color: #008000;"><br></span><span style="color: #008080;">&nbsp;4</span>&nbsp;<span style="color: #008000;"></span><span style="color: #008000;">*/</span><span style="color: #000000;"><br></span><span style="color: #008080;">&nbsp;5</span>&nbsp;<span style="color: #000000;"><br></span><span style="color: #008080;">&nbsp;6</span>&nbsp;<span style="color: #000000;"><br></span><span style="color: #008080;">&nbsp;7</span>&nbsp;<span style="color: #000000;">#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></span><span style="color: #008080;">&nbsp;8</span>&nbsp;<span style="color: #000000;">#include&nbsp;</span><span style="color: #000000;">&lt;</span><span style="color: #000000;">bios.h</span><span style="color: #000000;">&gt;</span><span style="color: #000000;"><br></span><span style="color: #008080;">&nbsp;9</span>&nbsp;<span style="color: #000000;">#include&nbsp;</span><span style="color: #000000;">&lt;</span><span style="color: #000000;">io.h</span><span style="color: #000000;">&gt;</span><span style="color: #000000;"><br></span><span style="color: #008080;">10</span>&nbsp;<span style="color: #000000;">#include&nbsp;</span><span style="color: #000000;">&lt;</span><span style="color: #000000;">dos.h</span><span style="color: #000000;">&gt;</span><span style="color: #000000;"><br></span><span style="color: #008080;">11</span>&nbsp;<span style="color: #000000;">#include&nbsp;</span><span style="color: #000000;">&lt;</span><span style="color: #000000;">dir.h</span><span style="color: #000000;">&gt;</span><span style="color: #000000;"><br></span><span style="color: #008080;">12</span>&nbsp;<span style="color: #000000;"></span><span style="color: #0000ff;">void</span><span style="color: #000000;">&nbsp;main()<br></span><span style="color: #008080;">13</span>&nbsp;<span style="color: #000000;">{<br></span><span style="color: #008080;">14</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">char</span><span style="color: #000000;">&nbsp;name[</span><span style="color: #000000;">40</span><span style="color: #000000;">];<br></span><span style="color: #008080;">15</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;FILE&nbsp;</span><span style="color: #000000;">*</span><span style="color: #000000;">p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">int</span><span style="color: #000000;">&nbsp;m,n;<br></span><span style="color: #008080;">16</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">char</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">*</span><span style="color: #000000;">v;<br></span><span style="color: #008080;">17</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">long</span><span style="color: #000000;">&nbsp;size;<br></span><span style="color: #008080;">18</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">int</span><span style="color: #000000;">&nbsp;i,j;<br></span><span style="color: #008080;">19</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">char</span><span style="color: #000000;">&nbsp;ch;<br></span><span style="color: #008080;">20</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">char</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">*</span><span style="color: #000000;">first</span><span style="color: #000000;">=</span><span style="color: #000000;">"</span><span style="color: #000000;">&nbsp;&nbsp;\tcode&nbsp;segment\n&nbsp;&nbsp;\t&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;assume&nbsp;&nbsp;cs:code,ds:code&nbsp;&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\torg&nbsp;100h\n&nbsp;&nbsp;begin:\n</span><span style="color: #000000;">"</span><span style="color: #000000;">;<br></span><span style="color: #008080;">21</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">char</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">*</span><span style="color: #000000;">end</span><span style="color: #000000;">=</span><span style="color: #000000;">"</span><span style="color: #000000;">&nbsp;&nbsp;\tcode&nbsp;ends\n&nbsp;\tend&nbsp;begin</span><span style="color: #000000;">"</span><span style="color: #000000;">;<br></span><span style="color: #008080;">22</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">int</span><span style="color: #000000;">&nbsp;len1,len2;<br></span><span style="color: #008080;">23</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">void</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">*</span><span style="color: #000000;">buf;<br></span><span style="color: #008080;">24</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">char</span><span style="color: #000000;">&nbsp;drive[</span><span style="color: #000000;">3</span><span style="color: #000000;">];</span><span style="color: #0000ff;">char</span><span style="color: #000000;">&nbsp;dir[</span><span style="color: #000000;">20</span><span style="color: #000000;">];</span><span style="color: #0000ff;">char</span><span style="color: #000000;">&nbsp;fname[</span><span style="color: #000000;">10</span><span style="color: #000000;">];</span><span style="color: #0000ff;">char</span><span style="color: #000000;">&nbsp;ext[</span><span style="color: #000000;">4</span><span style="color: #000000;">];<br></span><span style="color: #008080;">25</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">char</span><span style="color: #000000;">&nbsp;newname[</span><span style="color: #000000;">50</span><span style="color: #000000;">];<br></span><span style="color: #008080;">26</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">char</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">*</span><span style="color: #000000;">extt</span><span style="color: #000000;">=</span><span style="color: #000000;">"</span><span style="color: #000000;">.asm</span><span style="color: #000000;">"</span><span style="color: #000000;">;<br></span><span style="color: #008080;">27</span>&nbsp;<span style="color: #000000;"><br></span><span style="color: #008080;">28</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;printf(</span><span style="color: #000000;">"</span><span style="color: #000000;">enter&nbsp;the&nbsp;file&nbsp;name:\n</span><span style="color: #000000;">"</span><span style="color: #000000;">);<br></span><span style="color: #008080;">29</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;scanf(</span><span style="color: #000000;">"</span><span style="color: #000000;">%s</span><span style="color: #000000;">"</span><span style="color: #000000;">,&nbsp;&nbsp;name);<br></span><span style="color: #008080;">30</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">if</span><span style="color: #000000;">((p</span><span style="color: #000000;">=</span><span style="color: #000000;">fopen(name,</span><span style="color: #000000;">"</span><span style="color: #000000;">rb</span><span style="color: #000000;">"</span><span style="color: #000000;">))</span><span style="color: #000000;">==</span><span style="color: #000000;">NULL)<br></span><span style="color: #008080;">31</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;printf(</span><span style="color: #000000;">"</span><span style="color: #000000;">cann't&nbsp;open&nbsp;&lt;&nbsp;&nbsp;%s&nbsp;&gt;&nbsp;file!\n</span><span style="color: #000000;">"</span><span style="color: #000000;">,name);<br></span><span style="color: #008080;">32</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;exit(</span><span style="color: #000000;">0</span><span style="color: #000000;">);}<br></span><span style="color: #008080;">33</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;size</span><span style="color: #000000;">=</span><span style="color: #000000;">filelength(fileno(p));<br></span><span style="color: #008080;">34</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;buf</span><span style="color: #000000;">=</span><span style="color: #000000;">(</span><span style="color: #0000ff;">char</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">*</span><span style="color: #000000;">)malloc(size);<br></span><span style="color: #008080;">35</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;fread(buf,size,</span><span style="color: #000000;">1</span><span style="color: #000000;">,p);<br></span><span style="color: #008080;">36</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;fclose(p);<br></span><span style="color: #008080;">37</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;fnsplit(name,drive,dir,fname,ext);<br></span><span style="color: #008080;">38</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;fnmerge(newname,drive,dir,fname,extt);<br></span><span style="color: #008080;">39</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">if</span><span style="color: #000000;">((p</span><span style="color: #000000;">=</span><span style="color: #000000;">fopen(newname,</span><span style="color: #000000;">"</span><span style="color: #000000;">wb</span><span style="color: #000000;">"</span><span style="color: #000000;">))</span><span style="color: #000000;">==</span><span style="color: #000000;">NULL)<br></span><span style="color: #008080;">40</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="color: #008080;">41</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;printf(</span><span style="color: #000000;">"</span><span style="color: #000000;">can't&nbsp;creat&nbsp;&lt;&nbsp;%s&nbsp;&gt;&nbsp;file!\n</span><span style="color: #000000;">"</span><span style="color: #000000;">,newname);<br></span><span style="color: #008080;">42</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;exit(</span><span style="color: #000000;">0</span><span style="color: #000000;">);<br></span><span style="color: #008080;">43</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;}<br></span><span style="color: #008080;">44</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;fprintf(p,</span><span style="color: #000000;">"</span><span style="color: #000000;">%s\n</span><span style="color: #000000;">"</span><span style="color: #000000;">,first);<br></span><span style="color: #008080;">45</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;fprintf(p,</span><span style="color: #000000;">"</span><span style="color: #000000;">&nbsp;db&nbsp;&nbsp;</span><span style="color: #000000;">"</span><span style="color: #000000;">);<br></span><span style="color: #008080;">46</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">for</span><span style="color: #000000;">(i</span><span style="color: #000000;">=</span><span style="color: #000000;">0</span><span style="color: #000000;">,v</span><span style="color: #000000;">=</span><span style="color: #000000;">buf;i</span><span style="color: #000000;">&lt;</span><span style="color: #000000;">size;i</span><span style="color: #000000;">++</span><span style="color: #000000;">,v</span><span style="color: #000000;">++</span><span style="color: #000000;">)<br></span><span style="color: #008080;">47</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="color: #008080;">48</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;n</span><span style="color: #000000;">=*</span><span style="color: #000000;">v;<br></span><span style="color: #008080;">49</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;m</span><span style="color: #000000;">=</span><span style="color: #000000;">n;<br></span><span style="color: #008080;">50</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;n</span><span style="color: #000000;">=</span><span style="color: #000000;">n</span><span style="color: #000000;">&amp;</span><span style="color: #000000;">0x0f0</span><span style="color: #000000;">;<br></span><span style="color: #008080;">51</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;n</span><span style="color: #000000;">=</span><span style="color: #000000;">n</span><span style="color: #000000;">&gt;&gt;</span><span style="color: #000000;">4</span><span style="color: #000000;">;<br></span><span style="color: #008080;">52</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;m</span><span style="color: #000000;">=</span><span style="color: #000000;">m</span><span style="color: #000000;">&amp;</span><span style="color: #000000;">0x0f</span><span style="color: #000000;">;<br></span><span style="color: #008080;">53</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">if</span><span style="color: #000000;">(i</span><span style="color: #000000;">==</span><span style="color: #000000;">0</span><span style="color: #000000;">)<br></span><span style="color: #008080;">54</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="color: #008080;">55</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fprintf(p,</span><span style="color: #000000;">"</span><span style="color: #000000;">0%x%xh,</span><span style="color: #000000;">"</span><span style="color: #000000;">,n,m);<br></span><span style="color: #008080;">56</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">continue</span><span style="color: #000000;">;<br></span><span style="color: #008080;">57</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br></span><span style="color: #008080;">58</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">if</span><span style="color: #000000;">((i</span><span style="color: #000000;">%</span><span style="color: #000000;">15</span><span style="color: #000000;">)</span><span style="color: #000000;">==</span><span style="color: #000000;">0</span><span style="color: #000000;">)<br></span><span style="color: #008080;">59</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="color: #008080;">60</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fprintf(p,</span><span style="color: #000000;">"</span><span style="color: #000000;">0%x%xh</span><span style="color: #000000;">"</span><span style="color: #000000;">,n,m);<br></span><span style="color: #008080;">61</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fputc(</span><span style="color: #000000;">0x0d</span><span style="color: #000000;">,p);<br></span><span style="color: #008080;">62</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fputc(</span><span style="color: #000000;">0x0a</span><span style="color: #000000;">,p);<br></span><span style="color: #008080;">63</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">if</span><span style="color: #000000;">(i</span><span style="color: #000000;">==</span><span style="color: #000000;">(size</span><span style="color: #000000;">-</span><span style="color: #000000;">1</span><span style="color: #000000;">))<br></span><span style="color: #008080;">64</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">continue</span><span style="color: #000000;">;<br></span><span style="color: #008080;">65</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fprintf(p,</span><span style="color: #000000;">"</span><span style="color: #000000;">&nbsp;db&nbsp;&nbsp;</span><span style="color: #000000;">"</span><span style="color: #000000;">);}<br></span><span style="color: #008080;">66</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">else</span><span style="color: #000000;"><br></span><span style="color: #008080;">67</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{</span><span style="color: #0000ff;">if</span><span style="color: #000000;">(i</span><span style="color: #000000;">==</span><span style="color: #000000;">(size</span><span style="color: #000000;">-</span><span style="color: #000000;">1</span><span style="color: #000000;">))<br></span><span style="color: #008080;">68</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fprintf(p,</span><span style="color: #000000;">"</span><span style="color: #000000;">0%x%xh</span><span style="color: #000000;">"</span><span style="color: #000000;">,n,m);<br></span><span style="color: #008080;">69</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">else</span><span style="color: #000000;"><br></span><span style="color: #008080;">70</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fprintf(p,</span><span style="color: #000000;">"</span><span style="color: #000000;">0%x%xh,</span><span style="color: #000000;">"</span><span style="color: #000000;">,n,m);<br></span><span style="color: #008080;">71</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br></span><span style="color: #008080;">72</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;}<br></span><span style="color: #008080;">73</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;fprintf(p,</span><span style="color: #000000;">"</span><span style="color: #000000;">\n%s</span><span style="color: #000000;">"</span><span style="color: #000000;">,end);<br></span><span style="color: #008080;">74</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;fcloseall();<br></span><span style="color: #008080;">75</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;printf(</span><span style="color: #000000;">"</span><span style="color: #000000;">&nbsp;\t&nbsp;PLEASE&nbsp;EDIT&nbsp;%s\n</span><span style="color: #000000;">"</span><span style="color: #000000;">,newname);<br></span><span style="color: #008080;">76</span>&nbsp;<span style="color: #000000;"><br></span><span style="color: #008080;">77</span>&nbsp;<span style="color: #000000;">}<br></span><span style="color: #008080;">78</span>&nbsp;<span style="color: #000000;"></span></div>
<br><img src ="http://www.cppblog.com/socketref/aggbug/55259.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/socketref/" target="_blank">放屁啊狗</a> 2008-07-03 23:23 <a href="http://www.cppblog.com/socketref/archive/2008/07/03/55259.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>dos时代忘了处于什么目的写的读取汉字字模的程序</title><link>http://www.cppblog.com/socketref/archive/2008/07/03/55257.html</link><dc:creator>放屁啊狗</dc:creator><author>放屁啊狗</author><pubDate>Thu, 03 Jul 2008 15:19:00 GMT</pubDate><guid>http://www.cppblog.com/socketref/archive/2008/07/03/55257.html</guid><wfw:comment>http://www.cppblog.com/socketref/comments/55257.html</wfw:comment><comments>http://www.cppblog.com/socketref/archive/2008/07/03/55257.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/socketref/comments/commentRss/55257.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/socketref/services/trackbacks/55257.html</trackback:ping><description><![CDATA[<div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; background-color: #eeeeee; font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: #008080;">&nbsp;1</span>&nbsp;<span style="color: #000000;"><br></span><span style="color: #008080;">&nbsp;2</span>&nbsp;<span style="color: #000000;"></span><span style="color: #008000;">/*</span><span style="color: #008000;"><br></span><span style="color: #008080;">&nbsp;3</span>&nbsp;<span style="color: #008000;"><br></span><span style="color: #008080;">&nbsp;4</span>&nbsp;<span style="color: #008000;">读取汉字字模<br></span><span style="color: #008080;">&nbsp;5</span>&nbsp;<span style="color: #008000;">TC&nbsp;2.0<br></span><span style="color: #008080;">&nbsp;6</span>&nbsp;<span style="color: #008000;"><br></span><span style="color: #008080;">&nbsp;7</span>&nbsp;<span style="color: #008000;"></span><span style="color: #008000;">*/</span><span style="color: #000000;"><br></span><span style="color: #008080;">&nbsp;8</span>&nbsp;<span style="color: #000000;"><br></span><span style="color: #008080;">&nbsp;9</span>&nbsp;<span style="color: #000000;">#define&nbsp;STRING&nbsp;</span><span style="color: #000000;">"</span><span style="color: #000000;">程序:&nbsp;Z.Bin&nbsp;&nbsp;CopyRight&nbsp;Ver&nbsp;1.0&nbsp;98-10-05</span><span style="color: #000000;">"</span><span style="color: #000000;"><br></span><span style="color: #008080;">10</span>&nbsp;<span style="color: #000000;">#define&nbsp;CHAR_BYTE&nbsp;</span><span style="color: #000000;">40</span><span style="color: #000000;"><br></span><span style="color: #008080;">11</span>&nbsp;<span style="color: #000000;">#define&nbsp;OUTPUT_FILE&nbsp;</span><span style="color: #000000;">"</span><span style="color: #000000;">c:\\dat</span><span style="color: #000000;">"</span><span style="color: #000000;"><br></span><span style="color: #008080;">12</span>&nbsp;<span style="color: #000000;">#define&nbsp;SIZE&nbsp;CHAR_BYTE</span><span style="color: #000000;">*</span><span style="color: #000000;">16</span><span style="color: #000000;"><br></span><span style="color: #008080;">13</span>&nbsp;<span style="color: #000000;">#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></span><span style="color: #008080;">14</span>&nbsp;<span style="color: #000000;">#include&nbsp;</span><span style="color: #000000;">&lt;</span><span style="color: #000000;">graphics.h</span><span style="color: #000000;">&gt;</span><span style="color: #000000;"><br></span><span style="color: #008080;">15</span>&nbsp;<span style="color: #000000;">#include&nbsp;</span><span style="color: #000000;">&lt;</span><span style="color: #000000;">conio.h</span><span style="color: #000000;">&gt;</span><span style="color: #000000;"><br></span><span style="color: #008080;">16</span>&nbsp;<span style="color: #000000;">#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></span><span style="color: #008080;">17</span>&nbsp;<span style="color: #000000;"><br></span><span style="color: #008080;">18</span>&nbsp;<span style="color: #000000;"></span><span style="color: #0000ff;">void</span><span style="color: #000000;">&nbsp;&nbsp;main()<br></span><span style="color: #008080;">19</span>&nbsp;<span style="color: #000000;">{<br></span><span style="color: #008080;">20</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">int</span><span style="color: #000000;">&nbsp;At_x,color;<br></span><span style="color: #008080;">21</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">int</span><span style="color: #000000;">&nbsp;g</span><span style="color: #000000;">=</span><span style="color: #000000;">0</span><span style="color: #000000;">;</span><span style="color: #0000ff;">int</span><span style="color: #000000;">&nbsp;m;<br></span><span style="color: #008080;">22</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">int</span><span style="color: #000000;">&nbsp;CharNumber;<br></span><span style="color: #008080;">23</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">int</span><span style="color: #000000;">&nbsp;k;<br></span><span style="color: #008080;">24</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">int</span><span style="color: #000000;">&nbsp;i,j;<br></span><span style="color: #008080;">25</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">char</span><span style="color: #000000;">&nbsp;buf[SIZE];<br></span><span style="color: #008080;">26</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">char</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">*</span><span style="color: #000000;">p;<br></span><span style="color: #008080;">27</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">char</span><span style="color: #000000;">&nbsp;a;<br></span><span style="color: #008080;">28</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;FILE&nbsp;</span><span style="color: #000000;">*</span><span style="color: #000000;">fp;<br></span><span style="color: #008080;">29</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;initgraph(</span><span style="color: #000000;">&amp;</span><span style="color: #000000;">g,</span><span style="color: #000000;">&amp;</span><span style="color: #000000;">m,</span><span style="color: #000000;">"</span><span style="color: #000000;">C:\TC</span><span style="color: #000000;">"</span><span style="color: #000000;">);<br></span><span style="color: #008080;">30</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;p</span><span style="color: #000000;">=</span><span style="color: #000000;">buf;<br></span><span style="color: #008080;">31</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">if</span><span style="color: #000000;">((fp</span><span style="color: #000000;">=</span><span style="color: #000000;">fopen(OUTPUT_FILE&nbsp;,</span><span style="color: #000000;">"</span><span style="color: #000000;">wb</span><span style="color: #000000;">"</span><span style="color: #000000;">))</span><span style="color: #000000;">==</span><span style="color: #000000;">NULL)<br></span><span style="color: #008080;">32</span>&nbsp;<span style="color: #000000;">&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></span><span style="color: #008080;">33</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;printf(STRING);<br></span><span style="color: #008080;">34</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">for</span><span style="color: #000000;">(i</span><span style="color: #000000;">=</span><span style="color: #000000;">0</span><span style="color: #000000;">;i</span><span style="color: #000000;">&lt;=</span><span style="color: #000000;">223</span><span style="color: #000000;">;i</span><span style="color: #000000;">++</span><span style="color: #000000;">)<br></span><span style="color: #008080;">35</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="color: #008080;">36</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;buf[i]</span><span style="color: #000000;">=</span><span style="color: #000000;">0</span><span style="color: #000000;">;<br></span><span style="color: #008080;">37</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;}<br></span><span style="color: #008080;">38</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;At_x</span><span style="color: #000000;">=</span><span style="color: #000000;">0</span><span style="color: #000000;">;<br></span><span style="color: #008080;">39</span>&nbsp;<span style="color: #000000;"><br></span><span style="color: #008080;">40</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">for</span><span style="color: #000000;">(CharNumber</span><span style="color: #000000;">=</span><span style="color: #000000;">0</span><span style="color: #000000;">;CharNumber</span><span style="color: #000000;">&lt;</span><span style="color: #000000;">CHAR_BYTE;CharNumber</span><span style="color: #000000;">++</span><span style="color: #000000;">)<br></span><span style="color: #008080;">41</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="color: #008080;">42</span>&nbsp;<span style="color: #000000;"><br></span><span style="color: #008080;">43</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</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;">15</span><span style="color: #000000;">;j</span><span style="color: #000000;">++</span><span style="color: #000000;">)<br></span><span style="color: #008080;">44</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="color: #008080;">45</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">for</span><span style="color: #000000;">(i</span><span style="color: #000000;">=</span><span style="color: #000000;">0</span><span style="color: #000000;">;i</span><span style="color: #000000;">&lt;=</span><span style="color: #000000;">7</span><span style="color: #000000;">;i</span><span style="color: #000000;">++</span><span style="color: #000000;">)<br></span><span style="color: #008080;">46</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="color: #008080;">47</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;color</span><span style="color: #000000;">=</span><span style="color: #000000;">getpixel(At_x</span><span style="color: #000000;">+</span><span style="color: #000000;">i,j);<br></span><span style="color: #008080;">48</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">if</span><span style="color: #000000;">(color)<br></span><span style="color: #008080;">49</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{a</span><span style="color: #000000;">=</span><span style="color: #000000;">1</span><span style="color: #000000;">;&nbsp;a</span><span style="color: #000000;">=</span><span style="color: #000000;">a</span><span style="color: #000000;">&lt;&lt;</span><span style="color: #000000;">(</span><span style="color: #000000;">7</span><span style="color: #000000;">-</span><span style="color: #000000;">i);<br></span><span style="color: #008080;">50</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(</span><span style="color: #000000;">*</span><span style="color: #000000;">p)</span><span style="color: #000000;">=</span><span style="color: #000000;">(</span><span style="color: #000000;">*</span><span style="color: #000000;">p)</span><span style="color: #000000;">|</span><span style="color: #000000;">a;<br></span><span style="color: #008080;">51</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br></span><span style="color: #008080;">52</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br></span><span style="color: #008080;">53</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;p</span><span style="color: #000000;">++</span><span style="color: #000000;">;<br></span><span style="color: #008080;">54</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br></span><span style="color: #008080;">55</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;At_x</span><span style="color: #000000;">+=</span><span style="color: #000000;">8</span><span style="color: #000000;">;<br></span><span style="color: #008080;">56</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;}<br></span><span style="color: #008080;">57</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;fwrite(buf,</span><span style="color: #000000;">1</span><span style="color: #000000;">,SIZE,fp);<br></span><span style="color: #008080;">58</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;fclose(fp);<br></span><span style="color: #008080;">59</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #008000;">/*</span><span style="color: #008000;">getch();</span><span style="color: #008000;">*/</span><span style="color: #000000;"><br></span><span style="color: #008080;">60</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;closegraph();<br></span><span style="color: #008080;">61</span>&nbsp;<span style="color: #000000;">&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></span><span style="color: #008080;">62</span>&nbsp;<span style="color: #000000;">}</span></div>
<br><img src ="http://www.cppblog.com/socketref/aggbug/55257.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/socketref/" target="_blank">放屁啊狗</a> 2008-07-03 23:19 <a href="http://www.cppblog.com/socketref/archive/2008/07/03/55257.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>PPM(portable pixel map)</title><link>http://www.cppblog.com/socketref/archive/2008/06/24/54493.html</link><dc:creator>放屁啊狗</dc:creator><author>放屁啊狗</author><pubDate>Tue, 24 Jun 2008 13:11:00 GMT</pubDate><guid>http://www.cppblog.com/socketref/archive/2008/06/24/54493.html</guid><wfw:comment>http://www.cppblog.com/socketref/comments/54493.html</wfw:comment><comments>http://www.cppblog.com/socketref/archive/2008/06/24/54493.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/socketref/comments/commentRss/54493.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/socketref/services/trackbacks/54493.html</trackback:ping><description><![CDATA[reference: http://netpbm.sourceforge.net/doc/ppm.html<br><br>
<p>Each PPM image consists of the following:
</p>
<ol>
    <li>A "magic number" for identifying the file type.
    A ppm image's magic number is the two characters "P6".
    </li>
    <li>
    Whitespace (blanks, TABs, CRs, LFs).
    </li>
    <li>
    A width, formatted as ASCII characters in decimal.
    </li>
    <li>
    Whitespace.
    </li>
    <li>
    A height, again in ASCII decimal.
    </li>
    <li>
    Whitespace.
    </li>
    <li>
    The maximum color value (Maxval), again in ASCII decimal.  Must be less
    than 65536 and more than zero.
    </li>
    <li>A single whitespace character (usually a newline).
    </li>
    <li>A raster of Height rows, in order from top to bottom.  Each row
    consists of Width pixels, in order from left to right.  Each pixel is
    a triplet of red, green, and blue samples, in that order.  Each sample
    is represented in pure binary by either 1 or 2 bytes.  If the Maxval
    is less than 256, it is 1 byte.  Otherwise, it is 2 bytes.  The most
    significant byte is first.
    <p>A row of an image is horizontal.  A column is vertical.  The pixels
    in the image are square and contiguous.
    </p>
    </li>
    <li>In the raster, the sample values are "nonlinear." They are
    proportional to the intensity of the ITU-R Recommendation BT.709 red,
    green, and blue in the pixel, adjusted by the BT.709 gamma transfer
    function.  (That transfer function specifies a gamma number of 2.2 and
    has a linear section for small intensities).  A value of Maxval for
    all three samples represents CIE D65 white and the most intense color
    in the color universe of which the image is part (the color universe
    is all the colors in all images to which this image might be
    compared).
    <p>ITU-R Recommendation BT.709 is a renaming of the former CCIR
    Recommendation 709.  When CCIR was absorbed into its parent
    organization, the ITU, ca. 2000, the standard was renamed.  This
    document once referred to the standard as CIE Rec. 709, but it isn't
    clear now that CIE ever sponsored such a standard.
    </p>
    <p>Note that another popular color space is the newer sRGB.  A common
    variation on PPM is to subsitute this color space for the one specified.
    </p>
    </li>
    <li>
    Note that a common variation on the PPM format is to have the sample
    values be "linear," i.e. as specified above except without
    the gamma adjustment.  <strong>pnmgamma</strong> takes such a PPM variant as
    input and produces a true PPM as output.
    </li>
    <li>Strings starting with "#" may be comments, the same as
    with <a  href="http://netpbm.sourceforge.net/doc/pbm.html">PBM</a>.
    </li>
</ol>
<br><br><img src ="http://www.cppblog.com/socketref/aggbug/54493.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/socketref/" target="_blank">放屁啊狗</a> 2008-06-24 21:11 <a href="http://www.cppblog.com/socketref/archive/2008/06/24/54493.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>函数char2Hex()</title><link>http://www.cppblog.com/socketref/archive/2008/06/23/54318.html</link><dc:creator>放屁啊狗</dc:creator><author>放屁啊狗</author><pubDate>Sun, 22 Jun 2008 16:58:00 GMT</pubDate><guid>http://www.cppblog.com/socketref/archive/2008/06/23/54318.html</guid><wfw:comment>http://www.cppblog.com/socketref/comments/54318.html</wfw:comment><comments>http://www.cppblog.com/socketref/archive/2008/06/23/54318.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cppblog.com/socketref/comments/commentRss/54318.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/socketref/services/trackbacks/54318.html</trackback:ping><description><![CDATA[string Char2Hex(char a)<br>{<br>&nbsp;&nbsp;&nbsp; string str = "";<br>&nbsp;&nbsp;&nbsp; int n = a;<br>&nbsp;&nbsp;&nbsp; for (int i=2*sizeof(char) - 1; i&gt;=0; i--)<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; str += "0123456789ABCDEF"[((n &gt;&gt; i*4) &amp; 0xF)];<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; return str;<br>}<br><img src ="http://www.cppblog.com/socketref/aggbug/54318.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/socketref/" target="_blank">放屁啊狗</a> 2008-06-23 00:58 <a href="http://www.cppblog.com/socketref/archive/2008/06/23/54318.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>svn 基本配置</title><link>http://www.cppblog.com/socketref/archive/2008/06/20/54124.html</link><dc:creator>放屁啊狗</dc:creator><author>放屁啊狗</author><pubDate>Fri, 20 Jun 2008 05:39:00 GMT</pubDate><guid>http://www.cppblog.com/socketref/archive/2008/06/20/54124.html</guid><wfw:comment>http://www.cppblog.com/socketref/comments/54124.html</wfw:comment><comments>http://www.cppblog.com/socketref/archive/2008/06/20/54124.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/socketref/comments/commentRss/54124.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/socketref/services/trackbacks/54124.html</trackback:ping><description><![CDATA[创建svn 根目录<br>mkdir d:\snv-root<br>创建一个仓库<br>mkdir c:\svn-root\carkit<br>启动snv服务<br>svnserve -d -r c:\snv-root\carkit<br>同时启动多个仓库用监听服务端口号来区别<br>svnserve -d -r c:\snv-root\navi --listen-port 3691<br><br>修改认证密码<br>修改 carkit/conf/svnserve.conf 的 password-db = passwd<br>修改passwd文件，添加用户名称和帐号<br><br>客户端导入目录<br>svn import project1 svn://192.168.14.65 -m "test message"<br><img src ="http://www.cppblog.com/socketref/aggbug/54124.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/socketref/" target="_blank">放屁啊狗</a> 2008-06-20 13:39 <a href="http://www.cppblog.com/socketref/archive/2008/06/20/54124.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>玩了一下CEGUI，就想废掉现有的ui frame</title><link>http://www.cppblog.com/socketref/archive/2008/05/10/49389.html</link><dc:creator>放屁啊狗</dc:creator><author>放屁啊狗</author><pubDate>Fri, 09 May 2008 19:55:00 GMT</pubDate><guid>http://www.cppblog.com/socketref/archive/2008/05/10/49389.html</guid><wfw:comment>http://www.cppblog.com/socketref/comments/49389.html</wfw:comment><comments>http://www.cppblog.com/socketref/archive/2008/05/10/49389.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/socketref/comments/commentRss/49389.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/socketref/services/trackbacks/49389.html</trackback:ping><description><![CDATA[了解了一些CEGUI 基础的东西，觉得确实是个好东西，咋以前没早用她呢<br>cegui的widget一般都是texture绘制吧，也就是将 raster-image render到widget面。<br>之前正好把librsvg移植到wince上，看看是否能将svg扩展为cegui::drawable 对象, backend就采用 opengl<br><br>准备cegui到wince的移植工作<br><br><img src ="http://www.cppblog.com/socketref/aggbug/49389.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/socketref/" target="_blank">放屁啊狗</a> 2008-05-10 03:55 <a href="http://www.cppblog.com/socketref/archive/2008/05/10/49389.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>学Lua - HOWTO: Use the Unified Positions and Sizes System</title><link>http://www.cppblog.com/socketref/archive/2008/05/10/49387.html</link><dc:creator>放屁啊狗</dc:creator><author>放屁啊狗</author><pubDate>Fri, 09 May 2008 19:04:00 GMT</pubDate><guid>http://www.cppblog.com/socketref/archive/2008/05/10/49387.html</guid><wfw:comment>http://www.cppblog.com/socketref/comments/49387.html</wfw:comment><comments>http://www.cppblog.com/socketref/archive/2008/05/10/49387.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/socketref/comments/commentRss/49387.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/socketref/services/trackbacks/49387.html</trackback:ping><description><![CDATA[<p><strong>note: This page only applies to CEGUI &gt;= 0.4.0</strong>
</p>
<p>The unified metrics system in CEGUI 0.4.0 and up, allows you to
have both a relative and absolute component of a coordinate /
dimension. This gives you alot more flexibility in how you layout your
windows. For example you can use relative metrics for the height and
absolute metrics for the width. Or simply mix and match.
</p>
<p>There are three different forms in unified metrics:
</p>
<ul>
    <li>UDim - a single dimension.
    </li>
    <li>UVector2 - a two dimensional UDim vector
    </li>
    <li>URect - four UDims describing a rectangle by its left, top, right and bottom edges.
    </li>
</ul>
<p>The property system in CEGUI uses a special syntax for unified dimensions.
</p>
<table id="toc" class="toc" summary="Contents">
    <tbody>
        <tr>
            <td>
            <div id="toctitle">
            <h2>Contents</h2>
            <span class="toctoggle">[<a  href="javascript:toggleToc()" class="internal" id="togglelink">hide</a>]</span></div>
            <ul>
                <li class="toclevel-1"><a  href="http://www.cegui.org.uk/wiki/index.php/HOWTO:_Use_the_Unified_Positions_and_Sizes_System#UDim"><span class="tocnumber">1</span> <span class="toctext">UDim</span></a></li>
                <li class="toclevel-1"><a  href="http://www.cegui.org.uk/wiki/index.php/HOWTO:_Use_the_Unified_Positions_and_Sizes_System#UVector2"><span class="tocnumber">2</span> <span class="toctext">UVector2</span></a></li>
                <li class="toclevel-1"><a  href="http://www.cegui.org.uk/wiki/index.php/HOWTO:_Use_the_Unified_Positions_and_Sizes_System#URect"><span class="tocnumber">3</span> <span class="toctext">URect</span></a></li>
                <li class="toclevel-1"><a  href="http://www.cegui.org.uk/wiki/index.php/HOWTO:_Use_the_Unified_Positions_and_Sizes_System#XML_examples"><span class="tocnumber">4</span> <span class="toctext">XML examples</span></a></li>
            </ul>
            </td>
        </tr>
    </tbody>
</table>
<script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
<div class="editsection" style="float: right; margin-left: 5px;">[<a  href="http://www.cegui.org.uk/wiki/index.php?title=HOWTO:_Use_the_Unified_Positions_and_Sizes_System&amp;action=edit&amp;section=1" title="Edit section: UDim">edit</a>]</div>
<a name="UDim"></a>
<h2> UDim </h2>
<p>The UDim is the simplest.
</p>
<pre>{''scale'',''offset''}   fx:   {1,0}</pre>
<p>The scale component relative to the parent window, after it has been
translated to pixels the offset is added. So if we used the example
above as value for the <em>UnifiedWidth</em> property we would get a window exactly the width of its parent.
</p>
Another example could be
<pre>{0.5,25}</pre>
which would make it half the width of its parent plus 25 pixels.
<p>The properties that take a single UDim like the ones used above are:
</p>
<ul>
    <li>UnifiedXPosition
    </li>
    <li>UnifiedYPosition
    </li>
    <li>UnifiedWidth
    </li>
    <li>UnifiedHeight
    </li>
</ul>
<div class="editsection" style="float: right; margin-left: 5px;">[<a  href="http://www.cegui.org.uk/wiki/index.php?title=HOWTO:_Use_the_Unified_Positions_and_Sizes_System&amp;action=edit&amp;section=2" title="Edit section: UVector2">edit</a>]</div>
<a name="UVector2"></a>
<h2> UVector2 </h2>
<p>The UVector2 is used for position and size if you want avoid specifying each single dimension seperately (x,y,w,h).
</p>
<pre>{{''x-scale'',''x-offset''},{''y-scale'',''y-offset''}}   fx:   {{1,0},{1,0}}</pre>
<p>Besides the extra {..} around its two UDims it's very similar. Let's say we use the example above as value for the <em>UnifiedSize</em> property of a window, we would get a window that had exactly the same size as its parent.
</p>
<pre>{{1,0},{0,100}}</pre>
would yield a window width the same width as its parent but an absolute height of 100 pixels.
<p>The properties that take UVector2 values are:
</p>
<ul>
    <li>UnifiedPosition
    </li>
    <li>UnifiedSize
    </li>
    <li>UnifiedMinSize
    </li>
    <li>UnifiedMaxSize
    </li>
</ul>
<div class="editsection" style="float: right; margin-left: 5px;">[<a  href="http://www.cegui.org.uk/wiki/index.php?title=HOWTO:_Use_the_Unified_Positions_and_Sizes_System&amp;action=edit&amp;section=3" title="Edit section: URect">edit</a>]</div>
<a name="URect"></a>
<h2> URect </h2>
<p>The last type is URect. It's a little special in that it specifies the <em>left</em>, <em>top</em>, <em>right</em> and <em>bottom</em> edges instead of position and size.
As there is alot of parameters I'll write <em>ls</em> instead of <em>left-scale</em>, <em>to</em> instead of <em>top-offset</em> etc.
</p>
<pre>{{ls,lo},{ts,to},{rs,ro},{bs,bo}}   fx:   {{0,0},{0,0},{1,0},{1,0}}</pre>
<p>The example above is the default rectangle for a DefaultWindow type window. It will cover the entire area of it's parent window.
There is only one property that takes a URect. <em>UnifiedAreaRect</em>.
</p>
The fact that we are specifying edges instead of size, can be useful.
For example if we want a window to cover its entire parent, but leave a
10 pixel border a value like this could be used:
<pre>{{0,10},{0,10},{1,-10},{1,-10}}</pre>
<p>The x and y position are simple absolute-only dims with a value of
10 pixels. The right and bottom edges are 100% relative components with
a offset of -10 which will make it "move back" 10 pixels relative to
the parent's right and bottom edges.
</p>
<div class="editsection" style="float: right; margin-left: 5px;">[<a  href="http://www.cegui.org.uk/wiki/index.php?title=HOWTO:_Use_the_Unified_Positions_and_Sizes_System&amp;action=edit&amp;section=4" title="Edit section: XML examples">edit</a>]</div>
<a name="XML_examples"></a>
<h2> XML examples</h2>
<pre>&lt;Property Name="UnifiedPosition" Value="{{0.1,10},{1.0,-30}}" /&gt;<br></pre>
<p>X-position: 10% of the width of the parent window + 10 pixel 父窗体1/10+ 10个像素<br>
</p>
<p>Y-position: 30 pixel above the bottom of the parent window 父窗体高度差30个像数<br>
</p>
<p><br>
</p>
<pre>&lt;Property Name="UnifiedSize" Value="{{0.6,5},{0.3,20}}" /&gt;<br></pre>
<p>Width: 60% of the width of the parent window + 5 pixel
</p>
<p>Height: 30% of the height of the parent window + 20 pixel
</p>
<p><br>
</p>
<pre>&lt;Property Name="UnifiedXPosition" Value="{0.25,-5}" /&gt;<br></pre>
<p>X-position: 25% of the width of the parent window minus 5 pixel
</p>
<p><br>
</p>
<pre>&lt;Property Name="UnifiedAreaRect" Value="{{0.1,0},{0.1,0},{0.9,0},{0.9,0}}" /&gt;<br></pre>
<p>X-position: 10% of the width of the parent window.
</p>
<p>Y-position: 10% of the height of the parent window.
</p>
<p>Width: 80% of the width of the parent window.
</p>
<p>Height: 80% of the height of the parent window.
</p><img src ="http://www.cppblog.com/socketref/aggbug/49387.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/socketref/" target="_blank">放屁啊狗</a> 2008-05-10 03:04 <a href="http://www.cppblog.com/socketref/archive/2008/05/10/49387.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>学LUA - The Beginner Guide to Creating a CEGUI Window</title><link>http://www.cppblog.com/socketref/archive/2008/05/10/49386.html</link><dc:creator>放屁啊狗</dc:creator><author>放屁啊狗</author><pubDate>Fri, 09 May 2008 18:58:00 GMT</pubDate><guid>http://www.cppblog.com/socketref/archive/2008/05/10/49386.html</guid><wfw:comment>http://www.cppblog.com/socketref/comments/49386.html</wfw:comment><comments>http://www.cppblog.com/socketref/archive/2008/05/10/49386.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/socketref/comments/commentRss/49386.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/socketref/services/trackbacks/49386.html</trackback:ping><description><![CDATA[<p>The purpose of this tutorial is to show you how to create a simple
window and get it on screen. Before continuing here, it is very
important that you have already read and fully understood the articles <a  href="http://www.cegui.org.uk/wiki/index.php/The_Beginner_Guide_to_Getting_CEGUI_Rendering" title="The Beginner Guide to Getting CEGUI Rendering">The Beginner Guide to Getting CEGUI Rendering</a> and <a  href="http://www.cegui.org.uk/wiki/index.php/The_Beginner_Guide_to_Loading_Data_Files_and_Initialisation" title="The Beginner Guide to Loading Data Files and Initialisation">The Beginner Guide to Loading Data Files and Initialisation</a>; this is important because this tutorial builds upon the basic ideas introduced in those tutorials.
</p>
<p><br>
</p>
<table id="toc" class="toc" summary="Contents">
    <tbody>
        <tr>
            <td>
            <div id="toctitle">
            <h2>Contents</h2>
            <span class="toctoggle">[<a  href="javascript:toggleToc()" class="internal" id="togglelink">hide</a>]</span></div>
            <ul>
                <li class="toclevel-1"><a  href="http://www.cegui.org.uk/wiki/index.php/The_Beginner_Guide_to_Creating_a_CEGUI_Window#Introduction_to_window_and_widget_concepts"><span class="tocnumber">1</span> <span class="toctext">Introduction to window and widget concepts</span></a>
                <ul>
                    <li class="toclevel-2"><a  href="http://www.cegui.org.uk/wiki/index.php/The_Beginner_Guide_to_Creating_a_CEGUI_Window#Every_widget_is_a_window"><span class="tocnumber">1.1</span> <span class="toctext">Every widget is a window</span></a></li>
                    <li class="toclevel-2"><a  href="http://www.cegui.org.uk/wiki/index.php/The_Beginner_Guide_to_Creating_a_CEGUI_Window#Many_settings_are_inherited"><span class="tocnumber">1.2</span> <span class="toctext">Many settings are inherited</span></a></li>
                </ul>
                </li>
                <li class="toclevel-1"><a  href="http://www.cegui.org.uk/wiki/index.php/The_Beginner_Guide_to_Creating_a_CEGUI_Window#Creating_the_windows"><span class="tocnumber">2</span> <span class="toctext">Creating the windows</span></a>
                <ul>
                    <li class="toclevel-2"><a  href="http://www.cegui.org.uk/wiki/index.php/The_Beginner_Guide_to_Creating_a_CEGUI_Window#GUI_Creation_via_C.2B.2B_code"><span class="tocnumber">2.1</span> <span class="toctext">GUI Creation via C++ code</span></a></li>
                    <li class="toclevel-2"><a  href="http://www.cegui.org.uk/wiki/index.php/The_Beginner_Guide_to_Creating_a_CEGUI_Window#XML_layouts"><span class="tocnumber">2.2</span> <span class="toctext">XML layouts</span></a></li>
                </ul>
                </li>
                <li class="toclevel-1"><a  href="http://www.cegui.org.uk/wiki/index.php/The_Beginner_Guide_to_Creating_a_CEGUI_Window#Conclusion"><span class="tocnumber">3</span> <span class="toctext">Conclusion</span></a></li>
            </ul>
            </td>
        </tr>
    </tbody>
</table>
<script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
<div class="editsection" style="float: right; margin-left: 5px;">[<a  href="http://www.cegui.org.uk/wiki/index.php?title=The_Beginner_Guide_to_Creating_a_CEGUI_Window&amp;action=edit&amp;section=1" title="Edit section: Introduction to window and widget concepts">edit</a>]</div>
<a name="Introduction_to_window_and_widget_concepts"></a>
<h2> Introduction to window and widget concepts </h2>
<p>Before we get the the meat of this tutorial there are some essential ideas that you must first consider.
</p>
<div class="editsection" style="float: right; margin-left: 5px;">[<a  href="http://www.cegui.org.uk/wiki/index.php?title=The_Beginner_Guide_to_Creating_a_CEGUI_Window&amp;action=edit&amp;section=2" title="Edit section: Every widget is a window">edit</a>]</div>
<a name="Every_widget_is_a_window"></a>
<h3> Every widget is a window </h3>
<p>This is the most central concept that must be grasped when working
with CEGUI. Every widget within the system is derived from the same
Window base class; so for the purposes of this tutorial, whenever I
mention a window, the same ideas could just as easily be applied to a
push button or scrollbar widget.
</p>
<div class="editsection" style="float: right; margin-left: 5px;">[<a  href="http://www.cegui.org.uk/wiki/index.php?title=The_Beginner_Guide_to_Creating_a_CEGUI_Window&amp;action=edit&amp;section=3" title="Edit section: Many settings are inherited">edit</a>]</div>
<a name="Many_settings_are_inherited"></a>
<h3> Many settings are inherited </h3>
<p>Many of the settings and properties available for windows in CEGUI
are passed down the window hierarchy. For example, if you set the alpha
transparency on a particular window to 0.5, then by default, all window
and widgets attached to that window will also be affected by the change
applied at the higher level; although note also that the actual setting
on the child window remains unchanged - the final values and/or
settings used are usually some combination of the setting values from
all windows in the hierarchy down to the current window. This also
applies to things such as window destruction; by default, a window will
destroy attached child windows and widgets when it is destroyed. The
main advantages of this arrangement are that you can easily affect a
the whole GUI by making changes to the root window settings for things
like alpha, visibility, enabled / disabled state, and can easily 'clean
up' an entire GUI layout by simply destroying the root window. The
default 'inherited' behaviours can be overridden on a per window basis
where more fine grained control is needed, or where certain advanced
management techniques are to be used.
</p>
<p><br>
</p>
<div class="editsection" style="float: right; margin-left: 5px;">[<a  href="http://www.cegui.org.uk/wiki/index.php?title=The_Beginner_Guide_to_Creating_a_CEGUI_Window&amp;action=edit&amp;section=4" title="Edit section: Creating the windows">edit</a>]</div>
<a name="Creating_the_windows"></a>
<h2> Creating the windows </h2>
<p>Enough of the waffle!  Lets create a window.
</p>
<p>There are two ways of doing this, via C++ code and XML layout files.  Each approach is discussed below.
</p>
<div class="editsection" style="float: right; margin-left: 5px;">[<a  href="http://www.cegui.org.uk/wiki/index.php?title=The_Beginner_Guide_to_Creating_a_CEGUI_Window&amp;action=edit&amp;section=5" title="Edit section: GUI Creation via C++ code">edit</a>]</div>
<a name="GUI_Creation_via_C.2B.2B_code"></a>
<h3> GUI Creation via C++ code </h3>
<p>All windows in CEGUI are created by the WindowManager singleton
object. You can get access to this object via the usual getSingleton
method as follows:
</p>
<pre>using namespace CEGUI;<br>WindowManager&amp; wmgr = WindowManager::getSingleton();<br></pre>
<p>In general, you will be using what is known as a DefaultWindow (or
to use it's old name, DefaultGUISheet) as the 'root' window in your
GUI. This is not required, but is the accepted pattern of usage for
CEGUI and, once you start adding more top-level windows, helps simplify
laying things out.
</p>
<p>So, to get the ball rolling, we'll create a DefaultWindow as set it as the root 'GUI Sheet' for the GUI:
</p>
<pre>Window* myRoot = wmgr.createWindow( "DefaultWindow", "root" );<br>System::getSingleton().setGUISheet( myRoot );<br></pre>
<p>The createWindow method of the WindowManager takes two strings as
its parameters. The first one, "DefaultWindow" in this example, tells
the system the type or class of the window you wish to create.
Generally, the windows you have available are those which were
registered when you loaded your scheme file, although some, like
DefaultWindow, are global types and are always available. The second
parameter, "root" in this example, is a unique name which will be
assigned to the window; this name can be used to retrieve a pointer to
the window from the WindowManager at a later time. Note that naming
your root window "root" is not required, but is a common convention.
</p>
<p>The setGUISheet method in the System singleton object is used
to specify a given window as the root of the GUI. This will replace any
current sheet / root window, although do note that the previous window
hierarchy is not actually destroyed; it is just unlinked from the
display - you can easily switch between GUI 'pages' by simply flipping
between them using the setGUISheet method.
</p>
<p>Now you have created your first window and attached it to the
GUI system, and the system will use this window as the root of the GUI
when it draws the GUI. But, if you were to compile a simple program
using this code, you still can't see anything; what gives? There's
nothing wrong with your application, the DefaultWindow which we created
above is just totally invisible! This is what makes the DeafultWindow
ideally suited as a root window; it serves as a blank canvas onto which
other window and widgets can be attached. So, lets do that now...
</p>
<p>Here we will create a frame window; this is a window that
functions in a similar manner to the windows on your desktop UI, it has
a title bar and can be moved and re-sized.
</p>
<pre>FrameWindow* fWnd = (FrameWindow*)wmgr.createWindow( "TaharezLook/FrameWindow", "testWindow" );<br></pre>
<p>here we are creating a "TaharezLook/FrameWindow" window. This name
uses a convention seen throughout the system, whereby a window type is
prefixed by the name of the widget set (if you were to load the
WindowsLook scheme, you could create a "WindowsLook/FrameWindow" object
instead). We have given our new window the simple test name of
"testWindow". One final thing to note is the use of the cast, this is
required since the createWindow method always returns a base Window
type; in this, and many other cases a basic Window pointer will
suffice, but there are times when you'll want to access methods
introduced in the window and widget sub-classes, so the use of the cast
as shown is common when using CEGUI.
</p>
<p>In order for the system to be able to do something useful with our new window, we must perform a few additional steps.
</p>
<p>First, we must attach the window to the root window we established above:
</p>
<pre>myRoot-&gt;addChildWindow( fWnd );<br></pre>
<p>Now, we can set an initial position and size for our window. CEGUI
uses a 'unified' co-ordinate system enabling the use of relative
(scale) and absolute (offset) components at the same time - this is why
each co-ordinate you will see has two parts. For a slightly extended
introduction of this concept see <a  href="http://www.cegui.org.uk/wiki/index.php/Introduction_and_overview_of_core_%22Falagard%22_support_systems" title="Introduction and overview of core &quot;Falagard&quot; support systems">Introduction and overview of core "Falagard" support systems</a>.  Back to the example:
</p>
<pre>// position a quarter of the way in from the top-left of parent.<br>fWnd-&gt;setPosition( UVector2( UDim( 0.25f, 0 ), UDim( 0.25f, 0 ) ) );<br><br>// set size to be half the size of the parent<br>fWnd-&gt;setSize( UVector2( UDim( 0.5f, 0 ), UDim( 0.5f, 0 ) ) );<br></pre>
<p>Finally, we set a caption for the frame window's title bar:
</p>
<pre>fWnd-&gt;setText( "Hello World!" );<br></pre>
<p>And that's it!  When compiled into an application, you will now see a simple frame window in the middle of the display.
</p>
<p><br>
</p>
<div class="editsection" style="float: right; margin-left: 5px;">[<a  href="http://www.cegui.org.uk/wiki/index.php?title=The_Beginner_Guide_to_Creating_a_CEGUI_Window&amp;action=edit&amp;section=6" title="Edit section: XML layouts">edit</a>]</div>
<a name="XML_layouts"></a>
<h3> XML layouts </h3>
<p>All of the above is very nice, but there is one major drawback; any
time you wish to adjust the GUI layout, you need to edit your code and
recompile. This will get old pretty quick, so what you really want is
to be able to specify your GUI layout externally, and have your code
load the layout via a file. This is the purpose of the CEGUI layout XML
files.
</p>
<p>The system supports XML layout files, which can be loaded via
the WindowManager using the loadWindowLayout method. This method
creates all the windows for you and returns a pointer to the root
window of the loaded hierarchy; which is ideal for assigning as the
root of the GUI!
</p>
<p>So, first of all we need a layout file. The following XML saved
as a text file, is a layout file equivalent to the code we discussed
above:
</p>
<pre>&lt;?xml version="1.0"&nbsp;?&gt;<br>&lt;GUILayout&gt;<br>    &lt;Window Type="DefaultWindow" Name="root"&gt;<br>        &lt;Window Type="TaharezLook/FrameWindow" Name="testWindow"&gt;<br>            &lt;Property Name="UnifiedPosition" Value="{{0.25,0},{0.25,0}}" /&gt;<br>            &lt;Property Name="UnifiedSize" Value="{{0.5,0},{0.5,0}}" /&gt;<br>            &lt;Property Name="Text" Value="Hello World!" /&gt;<br>        &lt;/Window&gt;<br>    &lt;/Window&gt;<br>&lt;/GUILayout&gt;<br></pre>
<p>The Window elements show an obvious mapping to the createWindow
method from the WindowManager object; they take a type and a name which
directly correspond to the parameters discussed previously.
</p>
<p>Nesting of the Window elements is used to attach certain
windows to others. Note that you may only have one 'root' level window
in a layout file, which is another reason you'll usually see the
DefaultWindow used as a canvas on which other windows and widgets are
placed.
</p>
<p>The Property elements are used to set properties on the Window
being defined. There are many properties available for each
window/widget class, and each class also inherits all properties from
it's parent class. See the <a  href="http://www.cegui.org.uk/api_reference/namespaces.html" class="external text" title="http://www.cegui.org.uk/api_reference/namespaces.html" rel="nofollow">&lt;element&gt;Properties namespaces in the API reference</a>
for documentation on the available hard-coded properties and their
'value string' formats. Since 'Falagard' skins can create their own
properties, it is likely that the windows you are using contain many
more properties than listed in the previous link - for these 'soft'
properties, you need to consult whichever documentation is provided
with the skin you are using (for the sample skins see <a  href="http://www.cegui.org.uk/wiki/index.php/SetProperty" title="SetProperty">TaharezLook</a> and <a  href="http://www.cegui.org.uk/wiki/index.php/SetProperty_%28WindowsLook%29" title="SetProperty (WindowsLook)">WindowsLook</a>).
</p>
<p>If saved as a file called "test.layout", you could load this layout and set it as the GUI root as follows:
</p>
<pre>using namespace CEGUI;<br>Window* myRoot = WindowManager::getSingleton().loadWindowLayout( "test.layout" );<br>System::getSingleton().setGUISheet( myRoot );<br></pre>
<p>The end result is exactly the same as what was done in C++ code
earlier, except that now you can modify and enhance the GUI layout
without the need for constant editing and recompilation of the
application code.</p>
<br>
<p><br></p>
<br>
<p>理解以上教程很是简单，提供了两种创建widget的方法<br></p>
<p><br>
</p><img src ="http://www.cppblog.com/socketref/aggbug/49386.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/socketref/" target="_blank">放屁啊狗</a> 2008-05-10 02:58 <a href="http://www.cppblog.com/socketref/archive/2008/05/10/49386.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>至2008-5-8 firefox 浏览器书签</title><link>http://www.cppblog.com/socketref/archive/2008/05/08/49243.html</link><dc:creator>放屁啊狗</dc:creator><author>放屁啊狗</author><pubDate>Thu, 08 May 2008 12:29:00 GMT</pubDate><guid>http://www.cppblog.com/socketref/archive/2008/05/08/49243.html</guid><wfw:comment>http://www.cppblog.com/socketref/comments/49243.html</wfw:comment><comments>http://www.cppblog.com/socketref/archive/2008/05/08/49243.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/socketref/comments/commentRss/49243.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/socketref/services/trackbacks/49243.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: Bookmarks863上海瀚讯无线技术有限公司ARMDownload GNU ToolchainBlueToothBluetooth.org - Welcome to Bluetooth.orgWelcome to CSR - Changing the way the world co...&nbsp;&nbsp;<a href='http://www.cppblog.com/socketref/archive/2008/05/08/49243.html'>阅读全文</a><img src ="http://www.cppblog.com/socketref/aggbug/49243.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/socketref/" target="_blank">放屁啊狗</a> 2008-05-08 20:29 <a href="http://www.cppblog.com/socketref/archive/2008/05/08/49243.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>bsearch(0</title><link>http://www.cppblog.com/socketref/archive/2008/05/07/49075.html</link><dc:creator>放屁啊狗</dc:creator><author>放屁啊狗</author><pubDate>Tue, 06 May 2008 17:33:00 GMT</pubDate><guid>http://www.cppblog.com/socketref/archive/2008/05/07/49075.html</guid><wfw:comment>http://www.cppblog.com/socketref/comments/49075.html</wfw:comment><comments>http://www.cppblog.com/socketref/archive/2008/05/07/49075.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/socketref/comments/commentRss/49075.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/socketref/services/trackbacks/49075.html</trackback:ping><description><![CDATA[在移植glib到wince环境时，发现wince的c runtime library不包含很多库函数，诸如 bsearch() 半則搜索法，其用法有点像 std::bind2nd(),<br>费了点时间将其刨了出来，相信对有些人有用<br><br>
<div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; background-color: #eeeeee; font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: #008080;">&nbsp;1</span>&nbsp;<span style="color: #0000ff;">void</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">*</span><span style="color: #000000;">&nbsp;bsearch(<br></span><span style="color: #008080;">&nbsp;2</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">const</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">void</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">*</span><span style="color: #000000;">key,<br></span><span style="color: #008080;">&nbsp;3</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">const</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">void</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">*</span><span style="color: #000000;">base0,<br></span><span style="color: #008080;">&nbsp;4</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;size_t&nbsp;nmemb,<br></span><span style="color: #008080;">&nbsp;5</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;size_t&nbsp;size,<br></span><span style="color: #008080;">&nbsp;6</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">int</span><span style="color: #000000;">&nbsp;(</span><span style="color: #000000;">*</span><span style="color: #000000;">compar)(</span><span style="color: #0000ff;">const</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">void</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">*</span><span style="color: #000000;">,&nbsp;</span><span style="color: #0000ff;">const</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">void</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">*</span><span style="color: #000000;">))&nbsp;{<br></span><span style="color: #008080;">&nbsp;7</span>&nbsp;<span style="color: #000000;"><br></span><span style="color: #008080;">&nbsp;8</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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;">base&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;base0;<br></span><span style="color: #008080;">&nbsp;9</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;size_t&nbsp;lim;<br></span><span style="color: #008080;">10</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">int</span><span style="color: #000000;">&nbsp;cmp;<br></span><span style="color: #008080;">11</span>&nbsp;<span style="color: #000000;">