Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

using indexed (dbm) files

by pme (Vicar)
on Jan 30, 2004 at 09:59 UTC ( #325190=perlquestion: print w/replies, xml ) Need Help??
pme has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks, I'd like to use the indexed (dbm) files from both Perl and C. The file is generated from Perl and read by program written in C. I'm totally confused by the file formats (ndbm, gdbm, Berkeley DB etc.). What format should I use? On Debian 3.0r2 there is man page for dbopen, but the db.h contains the db_create() only. I'd like to avoid installing new libraraies. Thanks in advance

Replies are listed 'Best First'.
Re: using indexed (dbm) files
by DrHyde (Prior) on Jan 30, 2004 at 12:23 UTC
    There's a nice feature comparison table here.
      Thanks, I've bookmarked it!
Re: using indexed (dbm) files
by RandomWalk (Beadle) on Jan 30, 2004 at 16:45 UTC
    From "Learning Perl": you might also check your AnyDBM_file manpage and/or you might want to download the "which_dbm" utility from

    The latter diagnoses which db you've already got.

      Thanks, I'll try it.
Re: using indexed (dbm) files
by scottj (Monk) on Jan 31, 2004 at 10:13 UTC
    I have done this in the past with Berkeley DB and had much success.

    I had a CGI written in C (way back in the day) that would write to the Berkeley DB. Then my perl script would come along every so often and yank the data out of the Berkeley DB for processing.

    I don't have a lot of experience with the other options you listed, but Berkeley DB is a very robust system that will probably handle just about anything you need it for. And the folks at Sleepycat are great, too. :)
Re: using indexed (dbm) files
by Anonymous Monk on Jan 30, 2004 at 23:40 UTC
    remember that C requires null terminated strings while perl does not.
Re: using indexed (dbm) files
by astroboy (Chaplain) on Feb 02, 2004 at 12:41 UTC
    Came across this site a couple of weeks ago. They do a pretty good job of looking at the various DBMS's and supply sample code, etc
Re: using indexed (dbm) files
by Abigail-II (Bishop) on Jan 30, 2004 at 10:35 UTC
    Use whatever format you have support for.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://325190]
Approved by b10m
Front-paged by DrHyde
[GotToBTru]: 99% of all deaths take place within 24 hours of ingesting di-hydrogen monoxide
[GotToBTru]: time for some C8H10N4O2 for me
[ambrus]: GotToBTru: wait, you tell only the atom totals of what you want? Is that like ordering food in a restaurant by telling only the nutrient amounts you need, or
[ambrus]: like when a medieval scientist supposedly proves his priority inventing something by having previously published an anagram of a thousand letters long summary of the invention?

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (8)
As of 2016-12-06 13:04 GMT
Find Nodes?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:

    Results (104 votes). Check out past polls.