error C2664 VS2008 VC++ "strcpy":不能将参数2从"wchar_t * ” 转换为" const char * " 20
代码如下:OCloboclob;odyn.StartEdit();odyn.GetFieldValue("POWERFIELD2",&oclob);CStringstrE...
代码如下:
OClob oclob;
odyn.StartEdit();
odyn.GetFieldValue("POWERFIELD2", &oclob);
CString strExecuteSQL;
strExecuteSQL="ABCDCER";
unsigned long stringsize = strExecuteSQL.GetLength();
unsigned char *buffer = 0;
// calculate an optimum buffersize of approximately 32k bytes
unsigned long optchunk = oclob.GetOptimumChunkSize();
unsigned int bufsize = ((int)(32768/optchunk))*optchunk;
buffer = (unsigned char *)malloc(bufsize);
strcpy((char *)buffer, strExecuteSQL.GetBuffer(strExecuteSQL.GetLength()));
unsigned long totalwritten = 0;
unsigned long amtread = 0;
int piecetype = OLOB_FIRST_PIECE;
int flag = 0;
这是一段插入oracle的 clob数据的代码
请高手赐教! 展开
OClob oclob;
odyn.StartEdit();
odyn.GetFieldValue("POWERFIELD2", &oclob);
CString strExecuteSQL;
strExecuteSQL="ABCDCER";
unsigned long stringsize = strExecuteSQL.GetLength();
unsigned char *buffer = 0;
// calculate an optimum buffersize of approximately 32k bytes
unsigned long optchunk = oclob.GetOptimumChunkSize();
unsigned int bufsize = ((int)(32768/optchunk))*optchunk;
buffer = (unsigned char *)malloc(bufsize);
strcpy((char *)buffer, strExecuteSQL.GetBuffer(strExecuteSQL.GetLength()));
unsigned long totalwritten = 0;
unsigned long amtread = 0;
int piecetype = OLOB_FIRST_PIECE;
int flag = 0;
这是一段插入oracle的 clob数据的代码
请高手赐教! 展开
2个回答
展开全部
这是字符串编码问题吧,你的工程是不是设置成UNICODE编码,选择菜单 项目-属性-常规-字符集 那里设置成使用多字节字符集;或者把CString strExecuteSQL改成
CStringA strExecuteSQL,直接使用CString的多字符版本。希望对你有帮助
CStringA strExecuteSQL,直接使用CString的多字符版本。希望对你有帮助
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
buffer = (unsigned char *)malloc(bufsize);
strcpy((char *)buffer, strExecuteSQL.GetBuffer(strExecuteSQL.GetLength()));
===>
memcpy((char *)buffer, (char*)strExecuteSQL.GetBuffer(strExecuteSQL.GetLength()),strExecuteSQL.GetLength()*2);
strcpy((char *)buffer, strExecuteSQL.GetBuffer(strExecuteSQL.GetLength()));
===>
memcpy((char *)buffer, (char*)strExecuteSQL.GetBuffer(strExecuteSQL.GetLength()),strExecuteSQL.GetLength()*2);
追问
还是有点问题 只赋了strExecuteSQL中的一串字符串的第一个字符'A'给buffer
后面的“BCDCER”仍然没有赋值 是什么原因呢
追答
memcpy( 目标地址,源地址,长度)
你说的问题可能是长度计算不对。
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询