This is the mail archive of the cygwin@sources.redhat.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Why is dbm_store saving garbage to file?


Jeff Lu wrote:
> 
> Hi,
> 
> I'm trying to save some data using dbm but what's being written to the file
> is just gibberish.  The same code works in Unix/Linux.  Here's the code:
> 
>         dbm_local = dbm_open (database, O_RDWR|O_CREAT, 00664);
>         if(dbm_local)
>         {
>           strcpy(buffer, "CurrentOrderNumber");
>           key.dptr = buffer;
>           key.dsize = strlen(buffer)+1;
>           return_data = dbm_fetch(dbm_local, key);
>           if(return_data.dptr)
>             sprintf(count, "%d", atoi(return_data.dptr)+1);
>           else
>             strcpy(count, "1");
>           data_data.dptr = count;
>           data_data.dsize = strlen(count)+1;
>           dbm_store(dbm_local, key, data_data, DBM_REPLACE);
>           dbm_close (dbm_local);
>         }
> 
> Thanks

In which library are dbm_open, dbm_fetch, dbm_store, and dbm_close
implemented?  Are you using ndbm?  dbm?  Berkeley db?  or gdbm?  (Note
that only gdbm is a supported, 'official' cygwin package.)

--Chuck

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]