vi pongo un problemuccio...
ho un database (berkeley db) in un simpatico programma in c++.
inserisco un record in questo db e provo a riprenderlo con la stessa chiave.
risultato....

record not found VVoVe:

ovviamente sbaglio io qualcosa, ma non so cosa
lo ho sempre usato in c, e nell'imparare a usare le librerie da quelle per c a quelle per c++ magari ho fatto una pioggia di casini...

vi propongo una versione estratta da vari punti delle classi del codice incriminato:

grazie, ciao!

codice:
#include <iostream>
#include <string>
#include <db_cxx.h>
#include "Projects/NA++/Entry.h"
#include "Projects/NA++/Exceptions.h"

void insertRecord(Entry record,std::string insertKey, Db* db){
  Dbt key(const_cast<char*>(insertKey.c_str()), insertKey.length() + 1);
  Dbt data(&record, sizeof(Entry));
  db->put(NULL, &key, &data, 0);
}

Entry* getRecord(std::string getKey, Db* db){
  Dbt key, data;
  key.set_data(const_cast<char*>(getKey.c_str()));
  key.set_ulen(getKey.length() + 1);
  key.set_flags(DB_DBT_USERMEM);
  if(db->get(NULL, &key, &data, 0) == DB_NOTFOUND){
    throw NotFound();
  }
  return (Entry*)data.get_data();
}


int main(){
  try{
    Db* db;
    db = new Db(NULL, 0);
    u_int32_t oFlags = DB_CREATE;
    db->open(NULL, "db.db", NULL, DB_BTREE, oFlags, 0);
    std::string key1 = "key1", key2 = "key2";
    Auth status = DENIED;
    Entry entry1, entry2;
    strncpy(entry1.hash, "abcdefasjkjnklke", 17);
    strncpy(entry2.hash, "lkjhgfdsaqwertyu", 17);
    entry1.status = entry2.status = status;
    insertRecord(entry1, key1,db);
    insertRecord(entry2,key2,db);
    Entry* entry3 = getRecord(key1,db);
    Entry* entry4 = getRecord(key2,db);
  }catch(NotFound e){
    std::cout << "Ma pork!!!\n";
  }
}