<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Command Not Found</title>
	<atom:link href="http://lihui.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://lihui.wordpress.com</link>
	<description>Something about computer and coder</description>
	<lastBuildDate>Sun, 01 May 2011 16:16:16 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='lihui.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Command Not Found</title>
		<link>http://lihui.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://lihui.wordpress.com/osd.xml" title="Command Not Found" />
	<atom:link rel='hub' href='http://lihui.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Installing 64 bits Operation System</title>
		<link>http://lihui.wordpress.com/2010/06/12/installing-64-bits-operation-system/</link>
		<comments>http://lihui.wordpress.com/2010/06/12/installing-64-bits-operation-system/#comments</comments>
		<pubDate>Sat, 12 Jun 2010 03:56:52 +0000</pubDate>
		<dc:creator>lihui</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://lihui.wordpress.com/?p=67</guid>
		<description><![CDATA[我工作用的计算机是32位的intel cpu，最近要用虚拟机安装64位的操作系统，本来以为是不可能解决的问题，没想到intel有一种技术叫Virtualization Technology，可以解决此问题，只要将BIOS里的VT选项打开，即可以在32位机器上正常安装64位的操作系统了。<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lihui.wordpress.com&amp;blog=62739&amp;post=67&amp;subd=lihui&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>我工作用的计算机是32位的intel cpu，最近要用虚拟机安装64位的操作系统，本来以为是不可能解决的问题，没想到intel有一种技术叫Virtualization Technology，可以解决此问题，只要将BIOS里的VT选项打开，即可以在32位机器上正常安装64位的操作系统了。</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lihui.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lihui.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lihui.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lihui.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/lihui.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/lihui.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/lihui.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/lihui.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lihui.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lihui.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lihui.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lihui.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lihui.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lihui.wordpress.com/67/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lihui.wordpress.com&amp;blog=62739&amp;post=67&amp;subd=lihui&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://lihui.wordpress.com/2010/06/12/installing-64-bits-operation-system/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/100fc20d9e73def7b08dbc948ca4f289?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">lihui</media:title>
		</media:content>
	</item>
		<item>
		<title>How to avoid &#8220;Error writing output file&#8221; in C++ Builder 6</title>
		<link>http://lihui.wordpress.com/2010/04/09/how-to-avoid-error-writing-output-file-in-c-builder-6/</link>
		<comments>http://lihui.wordpress.com/2010/04/09/how-to-avoid-error-writing-output-file-in-c-builder-6/#comments</comments>
		<pubDate>Fri, 09 Apr 2010 02:49:15 +0000</pubDate>
		<dc:creator>lihui</dc:creator>
				<category><![CDATA[C/C++]]></category>

		<guid isPermaLink="false">http://lihui.wordpress.com/?p=64</guid>
		<description><![CDATA[在C++ Builder6编译程序的时，有时会出现&#8221;Error writing output file&#8221;的错误，通常情况下，是由于某个OBJ文件或者TDS文件被锁定（如属性是只读，或者被其他程序使用），解决方法也很简单，直接删除掉这些文件即可，如果删不掉的话，那就先关闭C++ Builder或者其他应用程序再试。<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lihui.wordpress.com&amp;blog=62739&amp;post=64&amp;subd=lihui&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>在C++ Builder6编译程序的时，有时会出现&#8221;Error writing output file&#8221;的错误，通常情况下，是由于某个OBJ文件或者TDS文件被锁定（如属性是只读，或者被其他程序使用），解决方法也很简单，直接删除掉这些文件即可，如果删不掉的话，那就先关闭C++ Builder或者其他应用程序再试。</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lihui.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lihui.wordpress.com/64/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lihui.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lihui.wordpress.com/64/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/lihui.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/lihui.wordpress.com/64/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/lihui.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/lihui.wordpress.com/64/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lihui.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lihui.wordpress.com/64/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lihui.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lihui.wordpress.com/64/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lihui.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lihui.wordpress.com/64/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lihui.wordpress.com&amp;blog=62739&amp;post=64&amp;subd=lihui&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://lihui.wordpress.com/2010/04/09/how-to-avoid-error-writing-output-file-in-c-builder-6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/100fc20d9e73def7b08dbc948ca4f289?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">lihui</media:title>
		</media:content>
	</item>
		<item>
		<title>How to avoid E2015 Ambiguity between &#8216;ULONG_PTR&#8217; and &#8220;Wmplib_tlb::ULONG_PTR&#8217;</title>
		<link>http://lihui.wordpress.com/2010/03/29/how-to-avoid-e2015-ambiguity-between-ulong_ptr-and-wmplib_tlbulong_ptr/</link>
		<comments>http://lihui.wordpress.com/2010/03/29/how-to-avoid-e2015-ambiguity-between-ulong_ptr-and-wmplib_tlbulong_ptr/#comments</comments>
		<pubDate>Mon, 29 Mar 2010 08:44:12 +0000</pubDate>
		<dc:creator>lihui</dc:creator>
				<category><![CDATA[C/C++]]></category>

		<guid isPermaLink="false">http://lihui.wordpress.com/?p=62</guid>
		<description><![CDATA[近日在程序里引用了windows media player组件，编译程序报了E2015的错。 E2015 Ambiguity between &#8216;ULONG_PTR&#8217; and &#8220;Wmplib_tlb::ULONG_PTR&#8217; 解决方法很多，个人觉得最一劳永逸的方法是直接修改Wmplib_tlb.h，把里面所有的Wmplib_tlb::ULONG_PTR全部替换为ULONG_PTR 注：此问题只存在于在C++Builder中导入Windows Media Player时，其他情况下不一定会发生。<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lihui.wordpress.com&amp;blog=62739&amp;post=62&amp;subd=lihui&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>近日在程序里引用了windows media player组件，编译程序报了E2015的错。</p>
<p>E2015 Ambiguity between &#8216;ULONG_PTR&#8217; and &#8220;Wmplib_tlb::ULONG_PTR&#8217;</p>
<p>解决方法很多，个人觉得最一劳永逸的方法是直接修改Wmplib_tlb.h，把里面所有的Wmplib_tlb::ULONG_PTR全部替换为ULONG_PTR</p>
<p>注：此问题只存在于在C++Builder中导入Windows Media Player时，其他情况下不一定会发生。</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lihui.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lihui.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lihui.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lihui.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/lihui.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/lihui.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/lihui.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/lihui.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lihui.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lihui.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lihui.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lihui.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lihui.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lihui.wordpress.com/62/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lihui.wordpress.com&amp;blog=62739&amp;post=62&amp;subd=lihui&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://lihui.wordpress.com/2010/03/29/how-to-avoid-e2015-ambiguity-between-ulong_ptr-and-wmplib_tlbulong_ptr/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/100fc20d9e73def7b08dbc948ca4f289?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">lihui</media:title>
		</media:content>
	</item>
		<item>
		<title>Tips about calling stored procedure from Oracle pro*c</title>
		<link>http://lihui.wordpress.com/2009/01/04/tips-about-calling-stored-procedure-from-oracle-proc/</link>
		<comments>http://lihui.wordpress.com/2009/01/04/tips-about-calling-stored-procedure-from-oracle-proc/#comments</comments>
		<pubDate>Sun, 04 Jan 2009 05:37:37 +0000</pubDate>
		<dc:creator>lihui</dc:creator>
				<category><![CDATA[C/C++]]></category>
		<category><![CDATA[database]]></category>

		<guid isPermaLink="false">http://lihui.wordpress.com/2009/01/04/tips-about-calling-stored-procedure-from-oracle-proc/</guid>
		<description><![CDATA[今天写一个测试程序，实验一下在pro*c里面调用存储过程，程序写好之后，发现预编译总是报错，错误代码是PCC-S-02022和PCC-F-02102，这两个错误看起来跟连锁错误一样。后来发现有如下几点需要注意的： 1、END-EXEC和END_EXEC 有部分教材的代码上写的是END_EXEC，不知道是不是教材陈旧，还是印刷错误，反正我查证之后发现应该写成END-EXEC才对。 2、proc编译选项 这个很重要，我曾经被次困扰了很长时间，我现在使用的选项如下 proc iname=test.cp include=./include userid=test/123456 mode=ansi code=ansi_c parse=full dynamic=ansi type_code=ansi ltype=none sqlcheck=full 其中sqlcheck=semantics也可以。但一定要保证userid的选项正确填写，否则肯定报错。<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lihui.wordpress.com&amp;blog=62739&amp;post=58&amp;subd=lihui&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>今天写一个测试程序，实验一下在pro*c里面调用存储过程，程序写好之后，发现预编译总是报错，错误代码是PCC-S-02022和PCC-F-02102，这两个错误看起来跟连锁错误一样。后来发现有如下几点需要注意的：<br />
<i>1、END-EXEC和END_EXEC</i><br />
有部分教材的代码上写的是END_EXEC，不知道是不是教材陈旧，还是印刷错误，反正我查证之后发现应该写成END-EXEC才对。</p>
<p><i>2、proc编译选项</i><br />
这个很重要，我曾经被次困扰了很长时间，我现在使用的选项如下<br />
proc iname=test.cp include=./include userid=test/123456 mode=ansi code=ansi_c parse=full dynamic=ansi type_code=ansi ltype=none sqlcheck=full<br />
其中sqlcheck=semantics也可以。但一定要保证userid的选项正确填写，否则肯定报错。</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lihui.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lihui.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lihui.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lihui.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/lihui.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/lihui.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/lihui.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/lihui.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lihui.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lihui.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lihui.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lihui.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lihui.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lihui.wordpress.com/58/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lihui.wordpress.com&amp;blog=62739&amp;post=58&amp;subd=lihui&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://lihui.wordpress.com/2009/01/04/tips-about-calling-stored-procedure-from-oracle-proc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/100fc20d9e73def7b08dbc948ca4f289?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">lihui</media:title>
		</media:content>
	</item>
		<item>
		<title>SQLITE3的C++简单封装类</title>
		<link>http://lihui.wordpress.com/2008/09/18/sqlite3%e7%9a%84c%e7%ae%80%e5%8d%95%e5%b0%81%e8%a3%85%e7%b1%bb/</link>
		<comments>http://lihui.wordpress.com/2008/09/18/sqlite3%e7%9a%84c%e7%ae%80%e5%8d%95%e5%b0%81%e8%a3%85%e7%b1%bb/#comments</comments>
		<pubDate>Thu, 18 Sep 2008 07:21:19 +0000</pubDate>
		<dc:creator>lihui</dc:creator>
				<category><![CDATA[C/C++]]></category>
		<category><![CDATA[database]]></category>

		<guid isPermaLink="false">http://lihui.wordpress.com/2008/09/18/sqlite3%e7%9a%84c%e7%ae%80%e5%8d%95%e5%b0%81%e8%a3%85%e7%b1%bb/</guid>
		<description><![CDATA[几年前写过一个简单的sqlite3读写，非常简陋，bug在所难免，旨在给初学者一点帮助，欢迎高手交流 // mySQLITE3.hpp // 该文件在visual c++ 6.0和c++ builder 6.0上均编译通过，在我自己的程序上运行好几年了 #ifndef __MY_SQLITE3_HPP__ #define __MY_SQLITE3_HPP__ #include &#34;sqlite3_lib\sqlite3.h&#34; #ifdef //--------------------------------------------------------------------------- class TMySQLite3 { private: sqlite3* _db; // 数据库实例 char* _errmsg; // 错误信息 char** _dbResult; // 记录集 public: TMySQLite3() { _db=NULL; _errmsg=NULL; } // 释放时，要先释放表并关闭数据库 ~TMySQLite3() { if (_dbResult) { sqlite3_free_table(_dbResult); } if (_db) { sqlite3_close(_db); } } // [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lihui.wordpress.com&amp;blog=62739&amp;post=54&amp;subd=lihui&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>几年前写过一个简单的sqlite3读写，非常简陋，bug在所难免，旨在给初学者一点帮助，欢迎高手交流</p>
<p><code><br />
// mySQLITE3.hpp<br />
// 该文件在visual c++ 6.0和c++ builder 6.0上均编译通过，在我自己的程序上运行好几年了<br />
#ifndef __MY_SQLITE3_HPP__<br />
#define __MY_SQLITE3_HPP__<br />
#include &quot;sqlite3_lib\sqlite3.h&quot;<br />
#ifdef<br />
//---------------------------------------------------------------------------<br />
class TMySQLite3<br />
{<br />
private:<br />
sqlite3* _db; // 数据库实例<br />
char* _errmsg; // 错误信息<br />
char** _dbResult; // 记录集<br />
public:<br />
TMySQLite3() { _db=NULL; _errmsg=NULL; }<br />
// 释放时，要先释放表并关闭数据库<br />
~TMySQLite3() {<br />
if (_dbResult) {<br />
sqlite3_free_table(_dbResult);<br />
}<br />
if (_db) {<br />
sqlite3_close(_db);<br />
}<br />
}<br />
// 打开数据库<br />
bool OpenDB(char* FullDBPath) {<br />
int result = sqlite3_open(FullDBPath, &amp;_db);<br />
if (result!=SQLITE_OK) return false;<br />
return true;<br />
}<br />
// 取数据记录<br />
char** FetchRecord(char* SQL, int* Row, int* Col) {<br />
int result = sqlite3_get_table(_db, SQL, &amp;_dbResult, Row, Col, &amp;_errmsg);<br />
if (result==SQLITE_OK) return _dbResult;<br />
else return NULL;<br />
}<br />
// 释放记录集<br />
void FreeRecord() {<br />
sqlite3_free_table(_dbResult);<br />
_dbResult = NULL;<br />
}<br />
// 执行SQL语句<br />
bool ExecSQL(char* SQL) {<br />
int result = sqlite3_exec(_db, SQL, NULL, NULL, &amp;_errmsg);<br />
if (result!=SQLITE_OK) return false;<br />
return true;<br />
}<br />
// 取得错误信息<br />
char* GetMessage() {<br />
return _errmsg;<br />
}<br />
};</code></p>
<p>#endif</p>
<p>下面是一段测试代码，Visual C++ 6.0的工程里面提炼出来的，供参考。<br />
<code><br />
TMySQLite3 *pLite;<br />
pLite =  new TMySQLite3(); // 创建实例<br />
// 打开数据库文件<br />
if (pLite-&gt;OpenDB(&quot;E:\\task.db&quot;)==false) {<br />
AfxMessageBox(pLite-&gt;GetMessage());<br />
}<br />
char** rs = NULL;<br />
int nRow=0, nCol=0;<br />
// 打开数据集<br />
rs = pLite-&gt;FetchRecord(&quot;select * from t_task&quot;, &amp;nRow, &amp;nCol);<br />
if (rs==NULL) AfxMessageBox(pLite-&gt;GetMessage());<br />
else {<br />
int nIndex=nCol;<br />
// 循环输出每行数据<br />
  for (int i=0; i&lt;nRow; i++) {<br />
    fprintf(stderr, "[%s]\t-\t[%s]\t-\t[%s]", rs[nIndex], rs[nIndex+1], rs[nIndex+2]);<br />
    nIndex += nCol;<br />
  }<br />
pLite-&gt;FreeRecord();<br />
}<br />
if (pLite) {<br />
delete pLite;<br />
pLite = NULL;<br />
}<br />
</code></p>
<p>t_task的建表脚本可以如下<br />
<code><br />
CREATE TABLE t_task<br />
(<br />
taskid    integer not null,<br />
tasktitle varchar(255) not null,<br />
tasktype  char(2) not null,<br />
taskdate  char(8) null<br />
)<br />
CREATE UNIQUE INDEX idx_task ON t_task(taskid)<br />
</code></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/lihui.wordpress.com/54/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/lihui.wordpress.com/54/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lihui.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lihui.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lihui.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lihui.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/lihui.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/lihui.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/lihui.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/lihui.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lihui.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lihui.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lihui.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lihui.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lihui.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lihui.wordpress.com/54/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lihui.wordpress.com&amp;blog=62739&amp;post=54&amp;subd=lihui&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://lihui.wordpress.com/2008/09/18/sqlite3%e7%9a%84c%e7%ae%80%e5%8d%95%e5%b0%81%e8%a3%85%e7%b1%bb/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/100fc20d9e73def7b08dbc948ca4f289?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">lihui</media:title>
		</media:content>
	</item>
		<item>
		<title>POP3 with OpenSSL 0.9.8</title>
		<link>http://lihui.wordpress.com/2007/12/13/pop3-with-openssl-098/</link>
		<comments>http://lihui.wordpress.com/2007/12/13/pop3-with-openssl-098/#comments</comments>
		<pubDate>Thu, 13 Dec 2007 08:08:05 +0000</pubDate>
		<dc:creator>lihui</dc:creator>
				<category><![CDATA[C/C++]]></category>
		<category><![CDATA[Dev/Study]]></category>
		<category><![CDATA[Network/Security]]></category>

		<guid isPermaLink="false">http://lihui.wordpress.com/2007/12/13/pop3-with-openssl-098/</guid>
		<description><![CDATA[自己写了一个小工具，用来检测POP3信箱是否有新邮件到了（其实邮件客户端outlook、foxmail等都可以检测，但不想在电脑上开太多的程序，所以自己写了一个），我一直用来检测公司邮箱，用得很好。前两天老婆说要用来检测gmail邮箱的邮件，却一直没反应，研究了一下gmail的说明，发现gmail的pop3需要ssl加密连接，所以就研究了一下OpenSSL的安装和使用 下载openssl-0.9.8.tar.gz，解压后，可以查看INSTALL.W32这个文件，告诉你在windows环境下如何编译和安装。 安装openssl之前你必须先安装Active Perl（http://www.activestate.com/ActivePerl）和NASM（http://www.kernel.org/pub/software/devel/nasm/binaries/win32/）（或者MASN，手册上说windows DDK里面包含了MASM，但是windows DDK不容易找，直接找MASM可能更容易些，比如asm.yeah.net里面就有下载的）。 我是在Borland C++ Builder 6环境下编译的，VC的方法也差不多。 进入到openssl解压后的目录，该目录下应该包含有README，NEWS等等文件，在windows控制台逐步执行下列步骤 &#62; perl Configure BC-32 生成配置文件 &#62; ms\do_nasm 生成makefile &#62; make -f ms\bcb.mak 生成结果 最终得到的lib文件在out32目录下，分别是libeay32.lib和ssleay32.lib 开发所用到的头文件在inc32目录下，你可以把这些文件组合到你同一个目录，以方便配置编译器选项 下面是一段用pop3来连接gmail的例子，供参考。 //--------------------------------------------------------------------------- // NOTE!!! // Change gmail account and password first before begin test. //--------------------------------------------------------------------------- #include "vcl.h" #pragma hdrstop #include "stdlib.h" #include "stdio.h" #include "conio.h" #include "winsock2.h" #include "openssl/ssl.h" [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lihui.wordpress.com&amp;blog=62739&amp;post=53&amp;subd=lihui&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>自己写了一个小工具，用来检测POP3信箱是否有新邮件到了（其实邮件客户端outlook、foxmail等都可以检测，但不想在电脑上开太多的程序，所以自己写了一个），我一直用来检测公司邮箱，用得很好。前两天老婆说要用来检测gmail邮箱的邮件，却一直没反应，研究了一下gmail的说明，发现gmail的pop3需要ssl加密连接，所以就研究了一下OpenSSL的安装和使用</p>
<p>下载openssl-0.9.8.tar.gz，解压后，可以查看INSTALL.W32这个文件，告诉你在windows环境下如何编译和安装。</p>
<p>安装openssl之前你必须先安装Active Perl（http://www.activestate.com/ActivePerl）和NASM（http://www.kernel.org/pub/software/devel/nasm/binaries/win32/）（或者MASN，手册上说windows DDK里面包含了MASM，但是windows DDK不容易找，直接找MASM可能更容易些，比如asm.yeah.net里面就有下载的）。</p>
<p>我是在Borland C++ Builder 6环境下编译的，VC的方法也差不多。</p>
<p>进入到openssl解压后的目录，该目录下应该包含有README，NEWS等等文件，在windows控制台逐步执行下列步骤</p>
<p><code>&gt; perl Configure BC-32</code><br />
生成配置文件</p>
<p><code>&gt; ms\do_nasm</code><br />
生成makefile</p>
<p><code>&gt; make -f ms\bcb.mak</code><br />
生成结果</p>
<p>最终得到的lib文件在out32目录下，分别是libeay32.lib和ssleay32.lib<br />
开发所用到的头文件在inc32目录下，你可以把这些文件组合到你同一个目录，以方便配置编译器选项</p>
<p>下面是一段用pop3来连接gmail的例子，供参考。</p>
<p><code><br />
//---------------------------------------------------------------------------<code /><code><br />
// NOTE!!!<code /><code><br />
// Change gmail account and password first before begin test.<code /><code><br />
//---------------------------------------------------------------------------<br />
#include "vcl.h"<br />
#pragma hdrstop<br />
#include "stdlib.h"<br />
#include "stdio.h"<br />
#include "conio.h"<br />
#include "winsock2.h"<br />
#include "openssl/ssl.h"<br />
#include "openssl/bio.h"<br />
#include "openssl/err.h"<br />
//---------------------------------------------------------------------------<br />
#pragma comment(lib, "ws2_32.lib")<br />
#pragma comment(lib, "openssl\\libeay32.lib")<br />
#pragma comment(lib, "openssl\\ssleay32.lib")</code><br />
<code>#pragma warn-8004<br />
#pragma argsused</p>
<p>int main(int argc, char* argv[])<br />
{<br />
  SSL * ssl;<br />
  SSL_CTX * ctx;<br />
  SOCKET sock;<br />
  char* hostname = "pop.gmail.com";<br />
  int port = 995;</code><br />
<code>  fprintf(stdout, "HOST: %s\t PORT: %d\nConnecting, standby...", hostname, port);</code><br />
<code>  // start winsock<br />
  WSAData ws;<br />
  WSAStartup(0x0101, &amp;ws);</code><br />
<code>  unsigned long ip = inet_addr(hostname);<br />
  hostent* h_entity;<br />
  if (ip == 0xFFFFFFFF) {<br />
    h_entity = gethostbyname(hostname);<br />
    if (!h_entity) {<br />
      fprintf(stdout, "Can't reach the host\n");<br />
      return -1;<br />
    }<br />
    memcpy(&amp;ip, h_entity-&gt;h_addr_list[0], sizeof(int));<br />
  }</p>
<p>  // create socket and connect to server<br />
  sockaddr_in server;<br />
  memcpy(&amp;server.sin_addr, &amp;ip, sizeof(int));<br />
  server.sin_port = htons(port);<br />
  server.sin_family = AF_INET;<br />
  memset(&amp;server.sin_zero, 0x00, 0x08);<br />
  sock = socket(AF_INET, SOCK_STREAM, IPPROTO_IP);<br />
  connect(sock, (sockaddr*)&amp;server, sizeof(server));</code></p>
<p><code>  // Load ssl context with socket binded<br />
  SSL_library_init();<br />
  SSL_load_error_strings();<br />
  ctx = SSL_CTX_new(SSLv23_client_method());<br />
  ssl = SSL_new(ctx);<br />
  SSL_set_fd(ssl, sock);<br />
  int sslErr = SSL_connect(ssl);</code><br />
<code>  char buff[1024];</code></p>
<p><code>  // Read welcome info<br />
  memset(buff, 0x0, sizeof(buff));<br />
  int total = SSL_read(ssl, buff, 1023);<br />
  fprintf(stdout, "\n%s", buff);</code></p>
<p><code>  // Send account<br />
  char* p = "USER youraccount@gmail.com\r\n";<br />
  SSL_write(ssl, p, strlen(p));</code><br />
<code>  memset(buff, 0x0, sizeof(buff));<br />
  total = SSL_read(ssl, buff, 1023);<br />
  fprintf(stdout, "\n%s", buff);</code></p>
<p><code>  // Send password<br />
  p = "PASS yourpassword\r\n";<br />
  SSL_write(ssl, p, strlen(p));<br />
  memset(buff, 0x0, sizeof(buff));<br />
  total = SSL_read(ssl, buff, 1023);<br />
  fprintf(stdout, "%s", buff);</code><br />
<code>  fprintf(stdout, "Disconnect from the server.\nPress any key to exit.\n");<br />
  getch();</code></p>
<p><code>  // Clear and free<br />
  SSL_shutdown(ssl);<br />
  closesocket(sock);<br />
  SSL_free(ssl);<br />
  SSL_CTX_free(ctx);<br />
  WSACleanup();<br />
  return 0;<br />
}</code></code></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/lihui.wordpress.com/53/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/lihui.wordpress.com/53/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lihui.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lihui.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lihui.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lihui.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/lihui.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/lihui.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/lihui.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/lihui.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lihui.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lihui.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lihui.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lihui.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lihui.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lihui.wordpress.com/53/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lihui.wordpress.com&amp;blog=62739&amp;post=53&amp;subd=lihui&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://lihui.wordpress.com/2007/12/13/pop3-with-openssl-098/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/100fc20d9e73def7b08dbc948ca4f289?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">lihui</media:title>
		</media:content>
	</item>
		<item>
		<title>two decimal reserved, without any zero rounded</title>
		<link>http://lihui.wordpress.com/2007/09/18/two-decimal-reserved-without-any-zero-rounded/</link>
		<comments>http://lihui.wordpress.com/2007/09/18/two-decimal-reserved-without-any-zero-rounded/#comments</comments>
		<pubDate>Tue, 18 Sep 2007 03:30:38 +0000</pubDate>
		<dc:creator>lihui</dc:creator>
				<category><![CDATA[C/C++]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[sybase]]></category>

		<guid isPermaLink="false">http://lihui.wordpress.com/2007/09/18/two-decimal-reserved-without-any-zero-rounded/</guid>
		<description><![CDATA[用C++Builder的QuickReport组件做几个报表，要求在查询的结果中所有的金额字段都要保留两位小数，并且不能丢失小数点后面的0。我用TListView呈现查询结果，用TQuickReport来设计报表样式。数据库是Sybase。 将查询结果直接填入到TListView之后，发现小数点后面是没有精度的，于是将查询语句里面加入了数据类型转换，如下： SELECT convert(decimal(13,2), amount) FROM anytable 在DBArtisan里面显示的结果没有问题，然后放到C++Builder里面执行，填入TListView里面还是舍掉了后面的0，没想到好办法，就用如下代码： char buff[15]; sprintf(buff, "%.02f", anyQry-&#62;FieldByName("amount")-&#62;AsFloat); 来转换，再填充到TListView。 而对于TQuickReport，本来以为很难搞，后来发现TQRDBText有一个属性叫Mask，设置为0.00，就可以起作用了。<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lihui.wordpress.com&amp;blog=62739&amp;post=52&amp;subd=lihui&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>用C++Builder的QuickReport组件做几个报表，要求在查询的结果中所有的金额字段都要保留两位小数，并且不能丢失小数点后面的0。我用TListView呈现查询结果，用TQuickReport来设计报表样式。数据库是Sybase。</p>
<p>将查询结果直接填入到TListView之后，发现小数点后面是没有精度的，于是将查询语句里面加入了数据类型转换，如下：</p>
<p><code>SELECT convert(decimal(13,2), amount) FROM anytable</code></p>
<p>在DBArtisan里面显示的结果没有问题，然后放到C++Builder里面执行，填入TListView里面还是舍掉了后面的0，没想到好办法，就用如下代码：<br />
<code><br />
char buff[15];<br />
sprintf(buff, "%.02f",  anyQry-&gt;FieldByName("amount")-&gt;AsFloat);</code></p>
<p>来转换，再填充到TListView。</p>
<p>而对于TQuickReport，本来以为很难搞，后来发现TQRDBText有一个属性叫Mask，设置为0.00，就可以起作用了。</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/lihui.wordpress.com/52/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/lihui.wordpress.com/52/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lihui.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lihui.wordpress.com/52/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lihui.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lihui.wordpress.com/52/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/lihui.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/lihui.wordpress.com/52/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/lihui.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/lihui.wordpress.com/52/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lihui.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lihui.wordpress.com/52/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lihui.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lihui.wordpress.com/52/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lihui.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lihui.wordpress.com/52/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lihui.wordpress.com&amp;blog=62739&amp;post=52&amp;subd=lihui&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://lihui.wordpress.com/2007/09/18/two-decimal-reserved-without-any-zero-rounded/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/100fc20d9e73def7b08dbc948ca4f289?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">lihui</media:title>
		</media:content>
	</item>
		<item>
		<title>Unexpected error while installing Sybase ASE 15.0 for Linux in RHEL AS4</title>
		<link>http://lihui.wordpress.com/2007/06/18/unexpected-error-while-installing-sybase-ase-150-for-linux-in-rhel-as4/</link>
		<comments>http://lihui.wordpress.com/2007/06/18/unexpected-error-while-installing-sybase-ase-150-for-linux-in-rhel-as4/#comments</comments>
		<pubDate>Mon, 18 Jun 2007 07:36:53 +0000</pubDate>
		<dc:creator>lihui</dc:creator>
				<category><![CDATA[database]]></category>
		<category><![CDATA[Linux/Unix]]></category>
		<category><![CDATA[sybase]]></category>
		<category><![CDATA[System]]></category>

		<guid isPermaLink="false">http://lihui.wordpress.com/2007/06/18/unexpected-error-while-installing-sybase-ase-150-for-linux-in-rhel-as4/</guid>
		<description><![CDATA[为了方便以后测试程序，昨天开始装RHEL4的虚拟机。 工作中用的服务器环境不是我装的，安装过程中遇到并解决了一点问题也算小有收获。 Red Hat的Enterprise Linux AS4算是比较成熟的商用Linux系统，整个安装过程十分顺利，为了确保以后安装Sybase等其他大型软件的方便，需要给虚拟机分配至少4G的虚拟硬盘空间。 安装Sybase之前，现创建了sybase用户和sybase组，sybase用户的根目录在/home/sybase下。同时在/opt下创建了sybase目录，供sybase程序使用，需设置chown sybase:sybase /opt/sybase 然后用sybase用户登录，安装Sybase ASE 15.0 for Linux。安装的时候最好选择custom方式，默认安装不包括ESQL/C的支持。 接下来的配置都比较简单，可以自己设置，也可以直接选择默认值。由于我只是在虚拟机下供测试用，所以我只装了Adaptive Server服务，其他的服务都没有装。 程序文件复制结束，安装程序会自动配置数据库，就在配置的时候报错了。 &#8220;/opt/sybase/ASE-15_0/bin/dataserver: error while loading shared libraries: libstdc++.so.5: cannot open shared object file: No such file or directory&#8221; 看来是libstdc++的库文件不兼容，于是就复制RHEL4 disc2中RPMS下的compat-libstdc++-33-3.2.3-47.3.i386.rpm和libstdc++-3.4.3-9.EL4.i386.rpm，并用rpm -Uvh *.rpm安装（我的安装是在X环境下进行的，所以出错之后没有退出），接着重试了配置数据库，就成功了。 手工启动数据库的命令在/opt/sybase/ASE-15_0/install/下，名为RUN_*，*为你的服务器名字。 默认情况下sybase只在127.0.0.1地址下监听TCP端口，所以在其他机器上是不能访问的，需要修改/etc/hosts文件中的域名解析。（如果启用了iptables，还需要开放sybase端口）<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lihui.wordpress.com&amp;blog=62739&amp;post=50&amp;subd=lihui&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>为了方便以后测试程序，昨天开始装RHEL4的虚拟机。<br />
工作中用的服务器环境不是我装的，安装过程中遇到并解决了一点问题也算小有收获。</p>
<p>Red Hat的Enterprise Linux AS4算是比较成熟的商用Linux系统，整个安装过程十分顺利，为了确保以后安装Sybase等其他大型软件的方便，需要给虚拟机分配至少4G的虚拟硬盘空间。</p>
<p>安装Sybase之前，现创建了sybase用户和sybase组，sybase用户的根目录在/home/sybase下。同时在/opt下创建了sybase目录，供sybase程序使用，需设置chown sybase:sybase /opt/sybase</p>
<p>然后用sybase用户登录，安装Sybase ASE 15.0 for Linux。安装的时候最好选择custom方式，默认安装不包括ESQL/C的支持。<br />
接下来的配置都比较简单，可以自己设置，也可以直接选择默认值。由于我只是在虚拟机下供测试用，所以我只装了Adaptive Server服务，其他的服务都没有装。</p>
<p>程序文件复制结束，安装程序会自动配置数据库，就在配置的时候报错了。<br />
&#8220;/opt/sybase/ASE-15_0/bin/dataserver: error while loading shared libraries: libstdc++.so.5: cannot open shared object file: No such file or directory&#8221;</p>
<p>看来是libstdc++的库文件不兼容，于是就复制RHEL4 disc2中RPMS下的compat-libstdc++-33-3.2.3-47.3.i386.rpm和libstdc++-3.4.3-9.EL4.i386.rpm，并用rpm -Uvh *.rpm安装（我的安装是在X环境下进行的，所以出错之后没有退出），接着重试了配置数据库，就成功了。</p>
<p>手工启动数据库的命令在/opt/sybase/ASE-15_0/install/下，名为RUN_*，*为你的服务器名字。</p>
<p>默认情况下sybase只在127.0.0.1地址下监听TCP端口，所以在其他机器上是不能访问的，需要修改/etc/hosts文件中的域名解析。（如果启用了iptables，还需要开放sybase端口）</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/lihui.wordpress.com/50/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/lihui.wordpress.com/50/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lihui.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lihui.wordpress.com/50/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lihui.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lihui.wordpress.com/50/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/lihui.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/lihui.wordpress.com/50/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/lihui.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/lihui.wordpress.com/50/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lihui.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lihui.wordpress.com/50/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lihui.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lihui.wordpress.com/50/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lihui.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lihui.wordpress.com/50/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lihui.wordpress.com&amp;blog=62739&amp;post=50&amp;subd=lihui&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://lihui.wordpress.com/2007/06/18/unexpected-error-while-installing-sybase-ase-150-for-linux-in-rhel-as4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/100fc20d9e73def7b08dbc948ca4f289?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">lihui</media:title>
		</media:content>
	</item>
		<item>
		<title>useful tips about sscanf</title>
		<link>http://lihui.wordpress.com/2007/06/12/useful-tips-about-sscanf/</link>
		<comments>http://lihui.wordpress.com/2007/06/12/useful-tips-about-sscanf/#comments</comments>
		<pubDate>Tue, 12 Jun 2007 02:27:14 +0000</pubDate>
		<dc:creator>lihui</dc:creator>
				<category><![CDATA[C/C++]]></category>
		<category><![CDATA[Dev/Study]]></category>

		<guid isPermaLink="false">http://lihui.wordpress.com/2007/06/12/useful-tips-about-sscanf/</guid>
		<description><![CDATA[大家可能都或多或少在C/C++语言中用过sscanf处理字符串，不过我倒用得不多，上次用这个函数还是半年前了。 这回有同事在用sscanf读取一串字符到一个结构体，以填充结构体的各个项，测试时发现sscanf会过滤掉开头的空白字符。 比如有如下结构体： typedef struct tagT { char a[3+1]; char b[5+1]; char c[3+1]; } T; 还有如下字符串： char *s = &#8220;01 2 &#8220;; 用如下方法读取： T t; memset(&#38;t, 0&#215;00, sizeof(T)); sscanf(s, &#8220;%3s%5s%3s&#8221;, &#38;t.a, &#38;t.b, &#38;t.c); printf(&#8220;a=/%s/\tb=/%s/\tc=/%s/\n&#8221;, t.a, t.b, t.c); 运行之后，会发现读入的字符串跟想像中的不一样： a=/01/ b=/2/ c=// 而我想要的结果是： a=/01 / b=/ / c=/ 2 / 这里的问题解决方法非常简单，只要把&#8221;%3s%5s%3s&#8221;中的s改成c即可，在sscanf中，%s是遇到非空格字符才开始读取的，直到读取到空格字符结束，而%c会把空格也读进来。 正确的解法是： sscanf(s, &#8220;%3c%5c%3c&#8221;, &#38;t.a, &#38;t.b, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lihui.wordpress.com&amp;blog=62739&amp;post=49&amp;subd=lihui&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>大家可能都或多或少在C/C++语言中用过sscanf处理字符串，不过我倒用得不多，上次用这个函数还是半年前了。<br />
这回有同事在用sscanf读取一串字符到一个结构体，以填充结构体的各个项，测试时发现sscanf会过滤掉开头的空白字符。<br />
比如有如下结构体：<br />
typedef struct tagT<br />
{<br />
  char a[3+1];<br />
  char b[5+1];<br />
  char c[3+1];<br />
} T;<br />
还有如下字符串：<br />
char *s = &#8220;01       2 &#8220;;<br />
用如下方法读取：<br />
T t;<br />
memset(&amp;t, 0&#215;00, sizeof(T));<br />
sscanf(s, &#8220;%3s%5s%3s&#8221;, &amp;t.a, &amp;t.b, &amp;t.c);<br />
printf(&#8220;a=/%s/\tb=/%s/\tc=/%s/\n&#8221;, t.a, t.b, t.c);<br />
运行之后，会发现读入的字符串跟想像中的不一样：<br />
a=/01/  b=/2/   c=//<br />
而我想要的结果是：<br />
a=/01 / b=/     / c=/ 2 /</p>
<p>这里的问题解决方法非常简单，只要把&#8221;%3s%5s%3s&#8221;中的s改成c即可，在sscanf中，%s是遇到非空格字符才开始读取的，直到读取到空格字符结束，而%c会把空格也读进来。</p>
<p>正确的解法是：<br />
sscanf(s, &#8220;%3c%5c%3c&#8221;, &amp;t.a, &amp;t.b, &amp;t.c);</p>
<p>而通过这个问题，发现了一个使用sscanf函数滤掉字符串首尾空格的方法，即sscanf(str, &#8220;%s&#8221;, str);</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/lihui.wordpress.com/49/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/lihui.wordpress.com/49/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lihui.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lihui.wordpress.com/49/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lihui.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lihui.wordpress.com/49/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/lihui.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/lihui.wordpress.com/49/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/lihui.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/lihui.wordpress.com/49/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lihui.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lihui.wordpress.com/49/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lihui.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lihui.wordpress.com/49/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lihui.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lihui.wordpress.com/49/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lihui.wordpress.com&amp;blog=62739&amp;post=49&amp;subd=lihui&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://lihui.wordpress.com/2007/06/12/useful-tips-about-sscanf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/100fc20d9e73def7b08dbc948ca4f289?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">lihui</media:title>
		</media:content>
	</item>
		<item>
		<title>char, wchar_t &amp; TCHAR</title>
		<link>http://lihui.wordpress.com/2007/05/10/char-wchar_t-tchar/</link>
		<comments>http://lihui.wordpress.com/2007/05/10/char-wchar_t-tchar/#comments</comments>
		<pubDate>Thu, 10 May 2007 02:27:22 +0000</pubDate>
		<dc:creator>lihui</dc:creator>
				<category><![CDATA[C/C++]]></category>
		<category><![CDATA[charset]]></category>
		<category><![CDATA[Dev/Study]]></category>

		<guid isPermaLink="false">http://lihui.wordpress.com/2007/05/10/char-wchar_t-tchar/</guid>
		<description><![CDATA[以前写程序都不太注意UNICODE问题，因为做的东西基本上都是在固定的平台上跑，而一般的函数用char传递字符串都没有问题。 这几天写程序遇到一个函数调用，居然只支持wchar_t的宽字符，就在程序里面写了不少wchar_t的字符串定义。写着写着就发现这样的代码太难看了，一会儿char，一会儿wchar_t的，乱。于是就返工，把他们都改成了TCHAR，并且定义了全局宏UNICODE（或者_UNICODE），这样一来，代码里面就都是TCHAR了。至于那些只支持UNICODE的函数，在编译的时候加入编译条件，如果没有定义UNICODE宏，就忽略他们吧。 相应的，有关字符串操作的函数，都改用了TCHAR.H里面定义的，比如strcpy改成了_tcscpy，sprintf改成了_stprintf<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lihui.wordpress.com&amp;blog=62739&amp;post=48&amp;subd=lihui&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>以前写程序都不太注意UNICODE问题，因为做的东西基本上都是在固定的平台上跑，而一般的函数用char传递字符串都没有问题。</p>
<p>这几天写程序遇到一个函数调用，居然只支持wchar_t的宽字符，就在程序里面写了不少wchar_t的字符串定义。写着写着就发现这样的代码太难看了，一会儿char，一会儿wchar_t的，乱。于是就返工，把他们都改成了TCHAR，并且定义了全局宏UNICODE（或者_UNICODE），这样一来，代码里面就都是TCHAR了。至于那些只支持UNICODE的函数，在编译的时候加入编译条件，如果没有定义UNICODE宏，就忽略他们吧。</p>
<p>相应的，有关字符串操作的函数，都改用了TCHAR.H里面定义的，比如strcpy改成了_tcscpy，sprintf改成了_stprintf</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/lihui.wordpress.com/48/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/lihui.wordpress.com/48/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lihui.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lihui.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lihui.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lihui.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/lihui.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/lihui.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/lihui.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/lihui.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lihui.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lihui.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lihui.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lihui.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lihui.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lihui.wordpress.com/48/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lihui.wordpress.com&amp;blog=62739&amp;post=48&amp;subd=lihui&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://lihui.wordpress.com/2007/05/10/char-wchar_t-tchar/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/100fc20d9e73def7b08dbc948ca4f289?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">lihui</media:title>
		</media:content>
	</item>
	</channel>
</rss>
