Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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++ÖпÕÖ¸ÕëÓë0ÓëNULLºÍÆäËûÈô¸ÉÎÊÌâС½á

ʲôÊÇ¿ÕÖ¸Õë³£Á¿£¨null pointer constant£©?
[6.3.2.3-3] An integer constant expression with the value 0, or such an expression cast to type void *, is called a null pointer constant.
ÕâÀï¸æËßÎÒÃÇ£º0¡¢0L¡¢'\0'¡¢3 - 3¡¢0 * 17 £¨ËüÃǶ¼ÊÇ“integer constant expression”£©ÒÔ¼° (void*)0 µÈ¶¼ÊÇ¿Õ ......

extern "C"

Èç¹ûC++µ÷ÓÃÒ»¸öCÓïÑÔ±àдµÄ.DLLʱ£¬µ±°üÀ¨.DLLµÄÍ·Îļþ»òÉùÃ÷½Ó¿Úº¯Êýʱ£¬Ó¦¼Óextern "C" {¡¡}¡£
È磺
Í·ÎļþcExample.h
#include <stdio.h>
#ifndef C_EXAMPLE_H
#define C_EXAMPLE_H
int add(int x,int y);
#endif

º¯ÊýʵÏÖÎļþcExample.c(×¢ÒâÊÇ.cÎļþ)
#include<stdio.h>
#include "cExample ......

C ++µÄµ¥Àýģʽ


µ¥Àýģʽ£º¶ÔÓ¦Ò»¸öÀàÖ»ÄÜÉú³ÉÒ»¸ö¶ÔÏó¡£
#include <stdio.h>
class A
{
 private:
  int id;
  A() {}//°Ñ¹¹Ô캯Êý·ÅÔÚprivate£ºÏÂÄ¿µÄÊÇÔÚÀàÍâ²»ÄÜÔÚÕ»ÉÏÖ±½Ó·ÖÅä¿Õ¼ä¶¨Òå¶ÔÏó¡£
 public:
  static A *pt;
  static A *instance()
   ......

The C Programming Language ¾­µä´úÂë any(s1,s2)

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

linux c alarm(0)µÄº¬Òå

Linux C¡¡¡¡alarmº¯Êý---Çë¿´×îºó
¡¡¡¡alarmÒ²³ÆÎªÄÖÖÓº¯Êý£¬Ëü¿ÉÒÔÔÙ½ø³ÌÖÐÉèÖÃÒ»¸ö¶¨Ê±Æ÷£¬µ±¶¨Ê±Æ÷Ö¸¶¨µÄʱ¼äµ½Ê±£¬ËüÏò½ø³Ç·¢ËÍSIGALARMÐźš£Òª×¢ÒâµÄÊÇ£¬Ò»¸ö½ø³ÌÖ»ÄÜÓÐÒ»¸öÄÖÖÓʱ¼ä£¬Èç¹ûÔÚµ÷ÓÃalarm֮ǰÒÑÉèÖùýÄÖÖÓʱ¼ä£¬ÔòÈκÎÒÔǰµÄÄÖÖÓʱ¼ä¶¼±»ÐÂÖµËù´úÌæ¡£
ËùÐèÍ·Îļþ
¡¡¡¡#include<unistd.h>
º¯Ê ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ