Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
From: Bob Vickers <bobv@dcs.rhbnc.ac.uk>
Subject: Using ndbm on OSF Unix 3.2
Date: 1996/10/28	[thread overview]
Message-ID: <3274E6C1.41C6@dcs.rhbnc.ac.uk> (raw)


Hello everyone,

I've been trying to use the ndbm routines but without success. This
little program fails with the strange error "not owner" (though it works
with the GNU emulation of ndbm). Am I doing something daft?

The program was compiled with 

	cc -o test7 -g2 -O0 -std1 test7.c
and is as follows:

#include <stdio.h>
#include <stdlib.h>
#include <ndbm.h>
#include <sys/mode.h>
#include <errno.h>
#include <fcntl.h>
#define DB_name  "dummy"
main() {
  DBM* db;

  datum key,content;
  int i;
  int stat;
  
  char string[10]="123456789";
  db =  dbm_open (DB_name, O_CREAT, S_IRWXU);
  if ( db == NULL)
    {
      perror("dbm_open failed");
      exit(1);
    }
  for (i=1;i<500000;i++) {

     if (i%500==0) printf("%d\n",i);    
     key.dsize=sizeof(i);
     key.dptr=(char *) (&i);

     content.dsize=sizeof(string);
     content.dptr=string;

     stat=dbm_store (db, key, content, DBM_INSERT);
  if ( stat != 0)
    {
      perror("dbm_store failed");
      exit(1);
    }
  }
  dbm_close (db);
}


Any suggestions gratefully received,
Bob
-- 
==============================================================================
Bob Vickers			R.Vickers@dcs.rhbnc.ac.uk
Department of Computer Science, Royal Holloway College, University of
London
WWW:	http://www.dcs.rhbnc.ac.uk/%7Ebobv/
Phone:	+44 1784 443691



                 reply	other threads:[~1996-10-28  5:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox