易截截图软件、单文件、免安装、纯绿色、仅160KB

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/C++字符串处理函数,希望对初学者有一定的帮助。
C:
char st[100];
1. 字符串长度
   strlen(st);
2. 字符串比较
   strcmp(st1,st2);
   strncmp(st1,st2,n);   把st1,st2的前n个进行比较。
3. 附加
 & ......

标准C的头文件assert.h学习总结

1:类似junit的断言,只是在assert中的断言,如果不满足的话就程序退出。
比如
#include <assert.h>

int main(void)
{
assert(6 < 5);
system("pause");
return 0;
}
在执行到assert(6 < 5);
的时候因为不满足断言,于是程序退出。
如果不想让assert(6 < 5)起作用,就在最上面添加宏定义# ......

c版的回调函数与c++版的虚函数

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 ......

C ++的单例模式


单例模式:对应一个类只能生成一个对象。
#include <stdio.h>
class A
{
 private:
  int id;
  A() {}//把构造函数放在private:下目的是在类外不能在栈上直接分配空间定义对象。
 public:
  static A *pt;
  static A *instance()
   ......

50个c/c++源代码网站(转载)

source: http://blog.renren.com/blog/229071289/443686923
C/C++是最主要的编程语言。这里列出了50名优秀网站和网页清单,这些网站提供c/c++源代码。这份清单提供了源代码的链接以及它们的小说明。我已尽力包括最佳的C/C++源代码的网站。这不是一个完整的清单,您有建议可以联系我,我将欢迎您的建议,以进一步加强这方面 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号