void Preprocess::WriteTotalArff(int DFthreshold,bool isbagOfWordsExist)
{
char *dbfield="CAbstract";
FUNCSEG seg=&Preprocess::goodWordsinPieceArticle;
ConstructMap(mymap,dbfield,seg);
cout<<"arff文件已经形成"<<endl;
string temp(infoFromWekaAddress);
cout<<"请您将使用weka聚类,并保存为"<<temp<<endl;
}
那么在constructMap中:
int Preprocess::ConstructMap(map<string,vector<pair<int,int>>>&mymap,char *dbfiled,FUNCSEG seg)
{
CoInitialize(NULL);
_ConnectionPtr pConn(__uuidof(Connection));
_RecordsetPtr pRst(__uuidof(Recordset));
pConn->ConnectionString=dbconnection;
pConn->Open("","","",adConnectUnspecified);
pRst=pConn->Execute(dbselect,NULL,adCmdText);
while(!pRst->rsEOF)
{ string rawtext=(_bstr_t)pRst->GetCollect(dbfield); 这句话会出问题
}
则不报错,但是运行时候,会出问题,转到系统文件comutil.h的如下位置
inline _variant_t::_variant_t(const char* pSrc)
{
V_VT(this) = VT_BSTR;
V_BSTR(this) = _com_util::ConvertStringToBSTR(pSrc);
}
但是如果做如下修改:
void WriteTotalArff(char * dbfield,int DFthreshlod,bool isbagOfwordsexsist);
即多给WrtieTotalArff一个参数,然后在主函数中声明:
char *dbfield="CAbstract"
如果做上面的修改则无任何错误,程序正常运行。
}
转到文件后,应该会告诉你出错的语句,你可以查看下相关变量的值.