home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / sys / sun / misc / 3369 < prev    next >
Encoding:
Text File  |  1992-07-28  |  1.4 KB  |  63 lines

  1. Path: sparky!uunet!dtix!darwin.sura.net!jvnc.net!yale.edu!qt.cs.utexas.edu!cs.utexas.edu!asuvax!farallon!NewsWatcher
  2. From: binky@farallon.com (Jeffrey B. Williams)
  3. Newsgroups: comp.sys.sun.misc
  4. Subject: ndbm(3)
  5. Message-ID: <binky-280792114824@192.100.87.178>
  6. Date: 28 Jul 92 19:19:02 GMT
  7. Sender: news@farallon.farallon.com
  8. Followup-To: comp.sys.sun.misc
  9. Organization: Farallon Computing
  10. Lines: 50
  11. Nntp-Posting-Host: 192.100.87.178
  12.  
  13. I'm having trouble with the nbdm(3) library functions, specifically
  14. dbm_open() and dbm_fetch().
  15.  
  16. problem 1, dbm_open():
  17.  
  18. DBM *db;
  19. char *filespec;
  20. *
  21. *
  22. *
  23. filespec = "some_db_file";
  24. db = dbm_open(filespec,O_CREATE|O_RDWR,S_IRWXU);
  25.  
  26. This statement leaves me, ostensibly, with a db that I can't dbm_store() to
  27. without getting a BUS error signal.  One work around I use is:
  28.  
  29. db = dbm_open(filespec,O_CREATE,S_IRWXU);
  30. dbm_close(db);
  31. db = dbm_open(filespec,O_RDWR,S_IRWXU);
  32.  
  33. Is there a better way?
  34.  
  35.  
  36.  
  37. problem 2, dbm_fetch():
  38.  
  39. DBM *db
  40. datum db_record, key;
  41. *
  42. *
  43. *
  44. db = some_db_open_func();
  45.  
  46. key.dptr = DB_REF_KEY;
  47. key.dsize = (int) sizeof(DB_REF_KEY);
  48.  
  49. db_record = dbm_fetch(db, key);
  50.  
  51. This statement ALWAYS yields me the SEGV error signal.  (Even when I seed
  52. the DB with makedbm prior to execution.)  Any ideas?
  53.  
  54. What I really need is better documentation.  Where can I find code samples,
  55. etc?  I've read the BSD source for ndbm(3), and it seems that given THAT
  56. source this code should work.
  57.  
  58. Please respond by email.
  59.  
  60. Thank you for any help.
  61.  
  62. Jeff (-:
  63.