|
版主,俺身边有同学用的QQ2440的板子,编译器是3.4.1的。他移植了sqlite3.6.X,并在程序中用到了sprintf函数如下:“sprintf(qry,"INSERT INTO \"user\" (username,password)\n" "VALUES ('%s','%s')", postvars[1],postvars[3]);”他的程序是可以正常运行的啊。
我从网上下载了一个sprintf.cpp文件(该文件号称“sprintf源码。独立一个文件就可用。在嵌入式等系统中可能用到。网上找了很多,多数都不能用或功能不全。这个是本人下了一翻功夫完善过的代码”),添加到$QTDIR/include文件夹下了。同时在我的主文件first.cpp中添加了:
/*************define area*****************/
#include <sprintf.cpp>
static char buff_mid[100]="HELLO!";
char * errMsg = NULL;
char * sql_CMD = NULL;
sqlite3 *db;
/**************sqlite3 part****************/
int sprintf(char *buf, const char *fmt, ...);//这是函数sprintf的声明
//是直接从sprintf.cpp文件中copy过来的
......
......
::sprintf(sql_CMD,"INSERT INTO Warn_TMP VALUES ('%s')",buff_mid);
::sqlite3_exec(db,sql_CMD,0,0,$errMsg);
但是编译通不过啊!! |
|