// Demo.cpp : Defines the entry point for the console application.//
#include "stdafx.h"
#include /*ctype.h*/#include /*stdlib.h*/#include /*stdio.h*/#include /*string.h*///#pragma comment(lib,"mcolib_shm.lib")#include "shmdb.h" /*用mcocomp生成的shmdb.h-文件*/#include #include
const char * dbname = "demoShmDb"; //DB名称const int SEGSZ = 1024 * 1024 * 10; //10M大小的数据库const uint2 PAGESIZE = 90; //页面大小
const int MAP_ADDRESS = 0x20000000; //内存地址
void SH(void) { char text[] = {"This sample demonstrates eXtremeDB shared memory interfaces"}; char text1[] = {"Copyright (c) 2001-2005 McObject LLC. All Right Reserved."};
printf("%s eXtremeDB runtime version %d.%d, build %d %s Press Enter to start",text, MCO_COMP_VER_MAJOR, MCO_COMP_VER_MINOR, MCO_COMP_BUILD_NUM,text1);
getchar();}
static int askNumber(const char *prompt) { char buf[300]; printf("%s", prompt); fgets(buf, sizeof (buf), stdin); if(isdigit(buf[0])) return atoi(buf); return -1;}
/*16进制转换成10进制*/static int hex2num(const char *s) { unsigned int a = 0;
while(*s) { int n; if( *s >= '0' && *s ='a' && *s ='A' && *s