On 4/6/06, 杰 张 <[EMAIL PROTECTED]> wrote:
> Hi all,
>       I just want to get the values of a table.The result implemented is 
> "Open OK!
>   segmentation fault ". Why did I got this result ? The following is my code:
>
>   #include <stdio.h>
> #include <string.h>
> #include "sqlite3.h"
> main()
> {
>     char **errmsg;
>     int ret;
>     int rc;
>       sqlite3 *db;
>     char *sql = "SELECT * FROM light;";
>     char ***resultp;
>     int *nrow;
>     int *ncolumn;
>     ret = sqlite3_open("sensor.db",&db);

Here you pass the address of db, which is already a pointer.
You've passed a pointer to a pointer but never allocated the structure used.

I think you want to change this:
>       sqlite3 *db;
to
>       sqlite3 db;



---
SqliteImporter: Command line fixed and delimited text import.
http://www.reddawn.net/~jsprenkl/Sqlite

Reply via email to