Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <gdbm.h>
- #include <stdio.h>
- #include <string.h>
- int main () {
- GDBM_FILE gdbm_f;
- datum key;
- datum value;
- gdbm_f = gdbm_open("test.dbm", 0, GDBM_READER, 0666, NULL );
- if(!gdbm_f){
- perror("Error");
- printf("えらー");
- return 1;
- }
- char *str = "www.yahoo.co.jp";
- key.dptr = str;
- key.dsize = strlen(str);
- value = gdbm_fetch( gdbm_f, key );
- if( value.dptr){
- printf("Data Fetched\n");
- printf("'%s' (%d)\n", value.dptr,value.dsize);
- }else{
- printf("Data Fetching faild\n");
- }
- gdbm_close( gdbm_f );
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement