How to get rid of extra data in character buffers for key and data

Hi -
Using the C API, I am using a cursor to just pull all the key/value pairs from a database.
Here is the relevant code:
/* Initialize key/data structures. */
memset(&key, 0, sizeof(key));
memset(&data, 0, sizeof(data));
key.flags = DB_DBT_MALLOC;
data.flags = DB_DBT_MALLOC;
if((ret = dbp->cursor(dbp, NULL, &cursor, 0)) != 0) {
dbp->err(dbp, ret, "%s", DATABASE);
goto err;
while((ret = cursor->c_get(cursor, &key, &data, DB_NEXT)) == 0) {
fprintf(cgiOut, "%s|||%s\n", (char *)key.data, (char *)data.data);
free(key.data);
free(data.data);
if(ret != DB_NOTFOUND) {
dbp->err(dbp, ret, "cursor->c_get");
goto err;
This produces lines that in many cases contain extra characters at the ends, as though the malloced data was not being cleared before use. I wrote this routine originally in Java, and solved the problem there with the "setReuseBuffer(false)" Database Entry routine. Is there something similar in C?
Garey Mills

Sandra -
I am using 4.5. I have solved the problem, however, by using the following code
while((ret = cursor->c_get(cursor, &key, &data, DB_NEXT)) == 0) {
char keyd, datad;
keyd = (char *)key.data;
datad = (char*)data.data;
keyd[key.size] = '\0';
datad[data.size] = '\0';
So I am just using the size data returned to null terminate the strings in the buffers. Now everything works. Thanks for your response;
Garey Mills

Similar Messages

  • How to get rid of 'Your computer's bluetooth firmware is up-to-date' message?

    Hi. I just updated the Bluetooth on my iMac (OS X 10.5), but now each time I turn on my computer, this (annoying) message show up: Your computer's bluetooth firmware is up-to-date.
    How to get rid of it?
    I tried someone's suggestion to turn it off by going to  System Preference > Account > Login Items, but it's not listed there..
    Also, is there a way to use FaceTime on my iMac?
    Thanks!

    Hello, not sure about the Bloetooth thing, I have none, but it sounds like some file didn't get removed aftrt a BT update.
    As far as FaceTime, no, it requires the App Store & 10.6.6...
    "To download FaceTime from the Mac App Store, you need a Mac with Mac OS X 10.6.6 or later."
    http://itunes.apple.com/us/app/facetime/id414307850?mt=12&ls=1
    Snow Leopard/10.6.x Requirements...
    General requirements
       * Mac computer with an Intel processor
        * 1GB of memory (I say 2GB at least)
        * 5GB of available disk space (I say 30GB at least)
        * DVD drive for installation
        * Some features require a compatible Internet service provider; fees may apply.
        * Some features require Apple’s MobileMe service; fees and terms apply.

  • How to get rid of extra iTunes credit?

    Okay, I know HOW to change the iTunes Store's countries, but I have an issue with my remaining store credit. I have £0.21 left to spend, and I cannot change the store to the US until I spend it. Is there any way to simply get rid of the extra credit?

    String's .trim method will probably be useful here:
    String path = System.getProperty("propDir").trim();

  • How to get rid of extra spaces while TRANSFERing itab to PersentationServer

    Gurus,
    we have a program which downloads the internal table to server using the TRANSFER statement.
    open dataset ---  BINARY MODE
    loop at ITAB.
    transfer ITAB-line to g_file.
    endloop.
    close dataset.
    This works fine.
    The new requirement is we need to get rid of the spaces that are padded at the end.
    ITAB data is RANDOM. The actual length of ITAB is 128 chars per line. Every 120 chars will have a eof char ( delimeter)
    so the last line of ITAB may have 1 or 2 delimeters in it. if it is just 1 we can solve it using SEARCH and TRANSFER---length
    if it gets 2 delimeters ?
    Thought????
    Any help is appreciated.
    Regards,
    Pete.

    Andreas,
    Thank you for the reply.
    I did use that. What I meant to say is when you have more than one EOL char in last line how do you find the last EOL and transfer upto that length.
    I used DO---ENDDO and checked for each existance of the EOL char. I am not pleased with what I am doing.
    Is there any better way to this ?
    Version - 4.6c.
    Regards
    Pete.

  • I keep getting a notification that says "Google Talk authentication failed"...does anyone know how to get rid of this?  I tried looking for it in the apps but not really sure what google talk is or how to get rid of this message that keeps popping up.

    How do i get rid of the message that keeps popping up that says "google talk authentication failed"????

    funwidowlady,
    Good afternoon!  I'm glad I can be here to help with this error. In the device this application is identified only as 'Talk', so that be more familiar to you. First I recommend opening the 'Market' app on your phone, then Menu>My Apps to see if this application requires an update. It will display a list on top of all applications that need to be updated. If nothing exists, tap 'Home' and go into 'Settings>Applications>Manage Applications>Talk, then tap 'Clear Cache' and 'Clear Data' to remove the history of that application and stop the notifications.  The app will remain on your phone for future use, if you desire to take advantage of it. Read more about Google Talk here
    Thank you!
    AdamE_VZW
    Follow us on Twitter @VZWSupport

  • How to get rid of mutiple events showing in calenders for the same event

    How do you get rid of mutiple events that show up in your calender of the same event. It doesn't matter what kind of event it is whether personel or yearly holiday it shows up mutiple times in the month view, list view. I've gone through and deleted events manually and said for all future events but this is time consuming, because you have to do it for each event. Is there a qicker way of getting this done? Also just an off note I found out that my bluetooth headsets stop ringing throught the ear piece like they did before the upgrade, any insight into this?

    If I understand your question correctly...
    try the following
    from Sources, choose the greyed out streaming library that you want to be rid of...in your case, make sure it is the right one, since they both have the same name.
    You should get a screen that says "Library Unavailable" with 2 menu choices below that, "OK" and "Disconnect from iTunes".
    Choose disconnect from iTunes and the library should be gone from your Sources.

  • How to get rid of extra plugins tab on Firefox 3.6 startup

    After a no-error crash Firefox 3.6 came back with extra tab. Tried every listed method could find but this tab could not be stopped from coming up when starting the program.
    Help.
    Don't want to upgrade!!! Everything was working fine until this. I changed nothing. Was working when all of a sudden it disappeared - no warning, no error message. When restarted instead of coming up with the usual list of tabs to restore, it came up in a new tab with a list of plug-ins it wanted me to update.
    Would like to get back to where it was before crash. Some of the plug-ins can't be upgraded and were fine before this happened.
    I do a lot of legacy work - all the way back to Windows 3.1, 4.0 along with DOS, and Mac OS 7, 8, & 9. I have two machines that are dedicated to hardware and software that are over 15 years old, whose output is in the same time, and at least the quality, of today's machines - These were high end machines in their day. Certain functions on any machine are limited by physics and mathematics, making these ol' clunkers comparable to today's in speed and quality. On a third is software whose functionality was never duplicated, whose producers are extinct as companies. Doing this kind of work has unearthed a dearth of folks who need legacy support, who don't want to (They are my customers. They are right! I can only question so much of what they want, very tactfully and carefully.), are not going to, or especially, can't afford to, upgrade, especially after hearing of costs and problems. I see a lot of early versions of Firefox, as well as other browsers, especially Netscape. I even keep one PC that runs DOS in order to work with folks who still use DOS based programs that work, especially POS stuff.
    That's why I'm retro. I deal with fossils which include paleo-Firefox.

    I just want what I had a few days ago back. Everything was working fine. I stay with the old version because it works for what I do. Foreign concept in today's world.
    Our gripe is that we are having upgrades forced on us that don't increase our productivity and cause losses of time and money in the process. None of this is free. Time is money. Switching to Windows 7 has cost me more money than I could afford, for instance. Upgrading Firefox throws out the use of some plug ins - they don't work on the newer versions and can't be upgraded - function gone.
    The Macs I still maintain are classic examples of upgrades not being useful forward steps for what I do. There are several programs were made for them that once their operating system upgraded became unusable, even in emulation. Their ease and functionality have never been reproduced in today's software. The old browser works fine on them today. I don't need the new features. I use VMWare in Windows 7 to run a program that, according to the maker, upgrades for the "insignificant" price of $999. That ain't chicken feed! It's the only way it will run. There was no problem with this on XP.
    In addition, I use these old machines in order to work with customer's old systems. When there are problems, a lot of what they have won't run on the newer machines at all. We get stuff so old we have to build machines to run it on as needed. And yes, a nightmare in extinct data, file formats - fun, fun fun.
    Yes, we are helping folks stay in the stone ages of computing. We can do no more than advise them on what is available and how it works. The final comedown is theirs since they are the people paying the money. On my machines I am the final say and I too keep legacy equipment both for working with customer problems and as I said, I have old software as well as hardware that does not work on today's OS and still works fine and is too costly and troublesome to upgrade as well as offering no improvement in quality and speed of output.
    Theory behind us now, how about some answers for the original question. Only in an ideal world is upgrading smooth. We don't live in one, nor would most of us want to. We are individuals.

  • How to get rid of extra browser support files without hosing the web help

    I produce web help for a a web app that is restricted to IE.
    When I generate web help, RH spits out dozens of files that support
    help within other browsers. We tried deleting these "extra" files,
    but it hosed the help. Does anyone know of a way to either 1)
    generate without these files or 2) remove the files without
    breaking web help?

    Welcome to our community, Karen
    If you took them out and it hosed the help, it would seem
    they are actually serving *SOME* function, no?
    I'd simply ignore things and just accept the fact that you
    get a lot of files with WebHelp.
    Cheers... Rick

  • How to get rid of extra background window

    New to CS6, which opens an extra blank background window/container that stays open, blocking desktop, when .psd is closed.  Hate it... how to make it stop?

    Thanks. Now I know what its called...

  • How to get rid of extra space at beginning of multiline field

    I have a form with both one-line and multiline fields. The one-line fields are fine, and the multiline fields look fine in LCD. However, when I open the form in Acrobat Pro, each multiline field has a blank space already in it! I checked with a user, and the same thing happens when she opens the form in Reader.
    I verified that this is a problem with multiline fields by changing a one-line field to multiline. As soon as I did, the extra space appeared in Pro & Reader.
    Has anyone else had this problem, and if so, what did you do about it?
    Thanks!
    Kathryn

    P. S. Since I had a number of multiline fields on my forms, I decided to venture into uncharted LCD territory and create a custom function which I could use as needed. What I thought would be a simple task ended up taking four hours. I'm posting what I discovered here in the hope that it may save someone else time :)
    First of all, apparently you can't create reusable functions in FormCalc, but only in JavaScript. You have to store them in a Script Object in order to make them available to the fields in the form. (Create the script object by right-clicking on the form in Hierarchy View and choose Insert Script Object).
    Converting the FormCalc function to JavaScript was an adventure. Long story short, this is what I ended up with:
    function space_bug_fix(field_name, field_contents)
    field_contents = escape(field_contents)
    //escapes the space to its URL encoding (%20) so the script can recognize it
    if (field_contents == "%20") {
    xfa.resolveNode(field_name).rawValue = "";
    //if the field contains only %20--in otherwords, the buggy space--delete it.
    I spent a while trying to get getField() to work, but apparently it doesn't work in the LCD xfa environment. You have to use resolveNode().
    Accessing the function was not straightforward either and also required use of the resolveNode function. This is the JavaScript I finally got to work:
    xfa.resolveNode("form1..custom_functions").space_bug_fix(this.name, this.rawValue);
    (custom_functions is the name I gave the script object). And as a reminder, the language in every event where this function is called has to be set to JavaScript.
    Kathryn

  • How to get rid of extra bar that comes with new update?

    I am a huge Mozilla fan and have used FireFox for many years now. The new update messed up the way I had my browser but I found an addon that let me move things where I wanted them once again. There is one thing I have been unable to fix though - the empty bar underneath the tabs that stretches horizontally for the entire screen. I have unchecked the bookmarks toolbar, addon toolbar and additional toolbar, but whatever bar this is it won't go away.
    I completely understand the need for the UI redesign and am not complaining.
    I uploaded a picture here.
    http://imgur.com/h0f9NRE
    As you can see, I like the minimalistic look and this bar is trampling upon that look. Once again I'm not complaining about the new UI, but will this bar be removable in a future update?

    That's not an extra bar; it's the navigation toolbar that's always been there.
    # Open the Add-ons Manager (Ctrl+Shift+A; Mac: Command+Shift+A), then the Extensions category.
    # Next to [https://addons.mozilla.org/firefox/addon/classicthemerestorer/ Classic Theme Restorer], click the Options button.
    # On the Main tab, under General UI, check "Hide navigation toolbar".

  • Does anyone know how to get rid of extra margin?

    My project looks great on screen, but prints with extra margin on the right, so that my brochures look funny....I tried to correct in the web picture window before printing but it continues to frustrate me. In windows I could go to print preview and adjust the margins there. Any suggestions?? My widow viewer is window photo viewer.

    Hmmm. I had this issue a while back when making some business cards. Looked great on screen but had a slight white border when printed. All I did was extended the frame out farther past the edges and they printed perfectly after that.

  • How to get rid of extra delayed click

    Hi, I have a Macbook and I recently upgraded to OSX Mavericks. I have noticed that now after I click on an something there is a second click that happens after, usually around 1 second later.
    Just to give an example when I am going through pictures in facebook and I am on picture 1. I click on the arrow to go to the next one. It stays on picture 2 for around a second before going to picture 3. If that makes sense? The same thing happens in iTunes if I click the play button, it pauses again a second later.
    Most of the time iTunes works okay but it always happens for Facebook.
    Just for your information I use the track pad and I have tried using another account.

    System Preferences > Trackpad > Accessibility
    Adjust the speed  - "Double-click speed" down a notch from the right side (Fast).
    You might also need to adjust the mouse settings as well.
    Some users have found that opening and closing AutoCAD fixed their scrolling issues.
    https://discussions.apple.com/message/25893724#25893724
    It never hurts to run the combo updater, but not sure it will fix this issue.
    OS X Mavericks 10.9.4 Update (Combo)
    http://support.apple.com/kb/DL1755
    MORE INFO ON WHY RUNNING COMBO FIXES ISSUES
    Apple updates available from the Software Update application are incremental updates. Delta updates are also incremental updates and are available from Apple Downloads (software updates are generally smaller than delta updates). The Combo updates contain all incremental updates and will update files that could have become corrupted.
    Combo updaters will install on the same version as they're applying--no need to roll back or do a clean install.
    "Delta" updaters can only take you from one version to the next. For example: 10.9.3 to 10.9.4. If somehow the 10.9.3 is missing something it should have, and that something isn't changed between 10.9.3 and 10.9.4 it will still be stale after the delta update.

  • I'm getting adds on my facebook page from coupon drop down. I'm using Safari atm and just wondering how to get rid of them? I've been into extentions and removed all of them but the adds are still present! Any help would be greatful.

    Does anyone know how I remove the pop ups as the pop up blocker is on and i've removed all extentions.

    Download and install GlimmerBlocker:
    http://glimmerblocker.en.softonic.com/mac

  • How to get rid of advertisements that appear on both the left and right of my web browsers

    Recently i noticed that when i open either Firefox or Safari, the page will load but a few seconds later, two identical ads appear on both sides of my browser and partially obstructing the webpage that i'm on... PLEASE HELP!
    this is what it looks like.... http://i43.tinypic.com/2q8aj9s.jpg

    Make sure 'block pop-ups' is selected in both browsers.
    Firefox Preferences>Content tab; Safari Preferences>Security tab.
    For both browsers download AdBlock:
    Firefox - https://addons.mozilla.org/en-US/firefox/search/?q=AdBlock&cat=1%2C0&appver=11.0 &platform=mac
    Safari - https://extensions.apple.com

Maybe you are looking for

  • Internal Table - Work Area issue

    Guru's: I am selecting the mentioned fields from TVAKT into t_itt1 (internal table) - I however an encountering "you canot use an internal table as a work area" as an error. DATA: s_bezei LIKE tvakt-bezei,       s_auart LIKE tvakt-auart. DATA t_itt1

  • Task created in onenote not syncing to iphone via outlook

    Hello, I am using OneNote for following the Getting Things Done book  by David Allen. I chose Onenote because it is more organized into notebooks, sections and pages and works well with Outlook. When I flag an item in OneNote and set a reminder for a

  • Home Sharing & Airplay limitation ?

    Hi, Can someone let me know if this is limitation due to stronger copyright constraints on movies than on music : I'm using home sharing between an iMac, 2 MacbookPros and an Apple TV 3rd generation. I can perfectly airplay a movie from my iMac iTune

  • How do I get a movie to play right away on my iPad while it's downloading

    How do I get a movie to play right away on my iPad while it's downloading

  • Report formula

    guys i saw a formula in a report and it was like this ([calculated keyfigure1] == 0) * 100 what does it mean? why 2 equal signs? thanks.