int main()//将单词录入数据库learn.db
{
FILE *fd=fopen("./dict.txt","r");
if(NULL==fd){
ERR_MSG("fopen");
return -1;
}
sqlite3 *db=NULL;
if(sqlite3_open("./learn.db",&db)!=SQLITE_OK){
fprintf(stderr,"line:%d %s\n",__LINE__,sqlite3_errmsg(db));
fprintf(stderr,"line:%d %d\n",__LINE__,sqlite3_errcode(db));
return -1;
}
char *errmsg=NULL;
char sql[128]="create table if not exists word (English char,Chinese char);";
if(sqlite3_exec(db,sql,NULL,NULL,&errmsg)!=SQLITE_OK){
fprintf(stderr,"line:%d sqlite3_exec:%s\n",__LINE__,errmsg);
return -1;
}
char buf[128]="";
int count=0;
while(1){
int m,n;
将单词导入到sqlite3数据库
最新推荐文章于 2023-01-05 19:01:02 发布