SQLite3的C编程
/*=================================
.* The Standard include file.
.*
.*===============================*/
#include <stdio.h>
#include <stdlib.h>
/*=================================
.*
.* The extend include file.
.*
.*===============================*/
#include "sqlite3.h"
/* #include "sqlite3ext.h" */
int main()
{
/* Connect SQLite system. */
sqlite3 *pDatabase = NULL;
int result;
char sql[500];
char *err_msg = NULL;
int i;
result = sqlite3_open("test.db3", &pDatabase);
if( result != SQLITE_OK ) {
printf("Failure to open the database.\n");
return -1;
} else
printf("Good to open the database.\n");
sprintf(sql,"BEGIN");
sqlite3_exec(pDatabase, sql,0,0,err_msg);
sprintf(sql, "CREATE TABLE [TestDB] (\
[id] int, [name] varchar(20), [age] int)");
/*
if (SQLITE_OK != sqlite3_exec(pDatabase, sql, 0, 0, &err_msg)) {
printf("operate failed: %s.\n", err_msg);
return -1;
}*/
for(i = 0; i < 10000; i++) {
sprintf(sql, "INSERT INTO [TestDB] ([id], [name], [age]) \
相关文档:
刚开始学C/C++时,一直对字符串处理函数一知半解,这里列举C/C++字符串处理函数,希望对初学者有一定的帮助。
C:
char st[100];
1. 字符串长度
strlen(st);
2. 字符串比较
strcmp(st1,st2);
strncmp(st1,st2,n); 把st1,st2的前n个进行比较。
3. 附加
& ......
C语言的回调函数思想代码:
#include <stdio.h>
void *max(void *base, unsigned int nmemb, unsigned int size,
int (*compar)(const void *, const void *))
{
int i;
void* max_data = base;
char* tmp = base;
&nbs ......
/*
* Exercise 2-5 Page 48
*
* Write the function any(s1,s2), which returns the first location
* in the string s1 where any character from the string s2 occurs,
* or -1 if s1 contains no characters from s2. (The standard library
* function strpbrk does the same job but returns a pointer t ......
C/C++底层实现指定磁盘只读 收藏
燕狂徒写的驱动挂钩,限制磁盘只读, 用于保证涉密计算机的稳定,相当于将磁盘变成ROM #include "ntddk.h"
#include
#include #define DRIVERNAME "OnlyRead(GongXiPeng!)" // for use in messages typedef struct tagDEVICE_EXTEN ......
source: http://blog.renren.com/blog/229071289/443686923
C/C++是最主要的编程语言。这里列出了50名优秀网站和网页清单,这些网站提供c/c++源代码。这份清单提供了源代码的链接以及它们的小说明。我已尽力包括最佳的C/C++源代码的网站。这不是一个完整的清单,您有建议可以联系我,我将欢迎您的建议,以进一步加强这方面 ......