dbTalk Databases Forums  

Misleading Code Sample in Getting Started Guide

comp.databases.berkeley-db comp.databases.berkeley-db


Discuss Misleading Code Sample in Getting Started Guide in the comp.databases.berkeley-db forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
firdaus.halim@gmail.com
 
Posts: n/a

Default Misleading Code Sample in Getting Started Guide - 03-21-2006 , 07:15 AM






Hi,

From:

http://www.sleepycat.com/docs/gsg/C/...eDatabaseRead:

------------
/* Database open omitted for clarity */

money = 122.45;

/* Zero out the DBTs before using them. */
memset(&key, 0, sizeof(DBT));
memset(&data, 0, sizeof(DBT));

/*
* Use our own memory to retrieve the float.
* For data alignment purposes.
*/
key.data = &money;
key.ulen = sizeof(float);
key.flags = DB_DBT_USERMEM;
------------

The above doesn't work. s/key.ulen/key.size/ fixed it.

Thanks,

Mohammed Firdaus


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.