delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2000/12/12/01:31:55

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Message-ID: <3A35C625.712F93DD@ece.gatech.edu>
Date: Tue, 12 Dec 2000 01:31:01 -0500
From: Charles Wilson <cwilson AT ece DOT gatech DOT edu>
X-Mailer: Mozilla 4.7 [en] (X11; U; SunOS 5.7 sun4u)
X-Accept-Language: en
MIME-Version: 1.0
To: Jeff Lu <jklcom AT mindspring DOT com>
CC: cygwin AT cygwin DOT com
Subject: Re: Why is dbm_store saving garbage to file?
References: <NDBBIHPECLIGKCCLMACAIEGKCIAA DOT jklcom AT mindspring DOT com>

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 AT sourceware DOT cygnus DOT com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019