在windows下通过VC6.0第一次用C调用SQLite
1. 下载SQLitewindows版
我们可以从下列网站下载sqlite的windows版。
http://www.sqlite.com.cn/bbs/topicdisp.asp?tid=182&topage=1#gotolast
下载这个三个文件:
SQLite 3.3.7 下载
windows版
sqlite-3_3_7.zip 这个是SQLite的windows可执行文件
sqlitedll-3_3_7.zip 这个是SQLite的windows库文件
sqlite-source-3_3_7.zip 这个是SQLite的windows下源码文件
如果你需要在windows下创建数据库,那么sqlite-3_3_7.zip是必须的
如果你需要在windows下编程,那么sqlitedll-3_3_7.zip、sqlite-source-3_3_7.zip是必须的
如果你需要在windows下学习研究数据库,那么sqlite-source-3_3_7.zip是必须的
2. 编译出Windows的Lib文件
这里可以参考: VC++使用事务来写SQLite3数据库
http://www.sqlite.com.cn/POParticle/4/106.Html
上面我们下载的包中没有Lib文件,那么我的自己动手编译出Windows的Lib文件
这里是用VC实现的具体方法:
启动一个命令行,进入VC的安装目录,我的目录是D:\Microsoft Visual Studio\VC98\Bin
在这个目录下面有一个LIB.exe文件,对,使用它咱们就能制作出咱们需要的SQLite3.lib文件,
将咱们在SQLite官方下载的sqlite-source-3_3_7.zip包中的SQLite3.def文件放到相同目录,
或者绝对路径也可以, 然后在命令行输入如下命令。
D:\Microsoft Visual Studio\VC98\Bin>LIB /MACHINE:IX86 /DEF:sqlite.def
这样我们就得到了一个SQLite3.lib文件
3. 用VC编译第一个C-sqlite3的程序
用一个编辑器编写一个简单C程序,命名为 opendbsqlite.c,如下:
// name: opendbsqlite.c
// This file is used to test C/C++ API for sqlite in VC6.0 on Windows Platform
// Author : zieckey
// 2006/11/5
#include <stdio.h>
#include "sqlite3.h"
int main( void )
{
sqlite3 *db=NULL;
char *zErrMsg = 0;
int rc;
rc = sqlite3_open("zieckey.db", &db); //打开指定的数据库文件,如果不存在将创建一个同名的数据库文件
if( rc )
{
fprintf(stderr, "Can't open database: %s\n", sqlite3_errmsg(db));
sqlite3_close(db);
exit(1);
}
else printf("open zieckey.db successfully!\n");
sqlite3_close(d
相关文档:
http://docs.google.com/View?docid=ajbgz6fp3pjh_2dwwwwt#_38239340844832237
It is not about optimization.
The whole idea of using 'do/while' version
is to make a macro which will
expand into a regular statement, not into a
compound statement. This is
done in order to make the use of function-s ......
函数名: strtok
功 能: 查找由在第二个串中指定的分界符分隔开的单词
用 法: char *strtok(char *str1, char *str2);
程序例:
&nbs ......
对于很多初学者来说,往往觉得回调函数很神秘,很想知道回调函数的工作原理。本文将要解释什么是回调函数、它们有什么好处、为什么要使用它们等等问题,在开始之前,假设你已经熟知了函数指针。
什么是回调函数?
简而言之,回调函数就是一个通过函数指针调用的函数。如果你把函数的指针(地址)作为参数传递给另 ......
一、什么是C/S和B/S
第一、什么是C/S结构。C/S
(Client/Server)结构,即大家熟知的客户机和服务器结构。它是软件系统体系结构,通过它可以充分利用两端硬件环境的优势,将任务合理分配到
Client端和Server端来实现,降低了系统的通讯开销。目前大多数应用软件系统都是Client/Server形式的两层结构,由于现在的软件应
......