View Single Post
Old 03-04-2005, 12:47   #1
NA01
Senior Member
 
L'Avatar di NA01
 
Iscritto dal: Jun 2003
Cittā: Genova
Messaggi: 5676
[berkley db] problemi con open

ho rimesso mano alle mie scarse conoscenze di questo db per fare un programmino stupidissimo.
ho scritto qualcosa come mi ricordavo e non andava nulla. mi dava un'errore sulla open.
sono andato sulla documentazione nel tarrball dei sorgenti e dā ragione al mio codice
peccato che anche un copia incolla dell'esempio non funziona assolutamente

l'esempio č questo
Codice:
#include <db.h>

int main(){
  DB *dbp;           /* DB structure handle */
  u_int32_t flags;   /* database open flags */
  int ret;           /* function return value */
  
/* Initialize the structure. This
 * database is not opened in an environment, 
 * so the environment pointer is NULL. */
  ret = db_create(&dbp, NULL, 0);
  if (ret != 0) {
    /* Error handling goes here */
  }

/* Database open flags */
  flags = DB_CREATE;    /* If the database does not exist, 
			 * create it.*/

  /* open the database */
  ret = dbp->open(dbp,        /* DB structure pointer */
		  NULL,       /* Transaction pointer */
		  "my_db.db", /* On-disk file that holds the database. */
		  NULL,       /* Optional logical database name */
		  DB_BTREE,   /* Database access method */
		  flags,      /* Open flags */
		  0);         /* File mode (using defaults) */
  if (ret != 0) {
    /* Error handling goes here */
  }
}
ed ecco a voi l'errore

Quote:
ultio@NA01:~$ gcc db.c -ldb-4.2
db.c: In function `main':
db.c:27: error: incompatible type for argument 4 of indirect function call
db.c:27: error: too many arguments to function


.....
aiuuuuuuuuuttttttttoooooooooooooooo!!!!


ciao
NA01 č offline   Rispondi citando il messaggio o parte di esso