我刚接触C++根本外行,按方案表格填了其中张xml_inte易做图ce.cpp出错,已经搞头晕,求教诸师 不胜感激!望那位师加我Q139160578以后能酬教
////
#ifdef WIN32
#include "xml_inte易做图ce.h"
#include "../defines/defines.h"
const char* str_xml =
"<Form Id = 'FMMIX039'>"
"<Label Id = 'label1' X = '20' Y = '30' Width = '200' Height = '20'>Master:_2w,1o6</Label>"
"<Label Id = 'label2' X = '20' Y = '50' Width = '200' Height = '20'>version plugin;1, 0, 4, 2</Label>"
"<Label Id = 'label3' X = '20' Y = '70' Width = '390' Height = '20'>BOT name:Embrace_Sunlight</Label>"
"<Label Id = 'label4' X = '20' Y = '120' Width = '200' Height = '20'>http://www.camfrog.com</Label>"
"<Label Id = 'label5' X = '20' Y = '160' Width = '390' Height = '20'>Please enter your Owner password and press Set/ver command</Label>"
"<Edit Id = 'edit_password' X = '20' Y = '182' Width = '280' Height = '22' IsEnabled = 'true'></Edit>"
"<Button Id = 'button_password_set' X = '320' Y = '180' Width = '70' Height = '25' IsEnabled = 'true'>Set</Button>"
"</Form>";
const char* state_xml =
"<FormState Id = 'FMMIX039'>"
"<Edit Id = 'edit_password' X = '20' Y = '182' Width = '280' Height = '22' IsEnabled = 'true'>%s</Edit>"
"<Button Id = 'button_password_set' X = '320' Y = '180' Width = '70' Height = '25' IsEnabled = 'true'>Set</Button>"
"</FormState>";"FormState fmmix039 Edit edit_new_text Button button_set true bad allocation FMMIX039 FMMIX039 FMMIX039 "FMCFPMIX" plugin Fire__Man. FMMIX039 "FMCFPMIX" plugin Fire__Man. bad allocation string too long invalid string position *C csmUnknown exception cmd.exe/c COMSPEC bad exception LC_TIME LC_NUMERIC LC_MONETARY LC_CTYPE LC_COLLATE LC_ALL"
xml_core::xml_core(bot_manager *mngr)
;{
_mngr = mngr;
}
xml_core::~xml_core()
{
}
bool xml_core::startup(std::string &init_data)
{
init_data = str_xml;
TiXmlDocument doc;
doc.Parse(str_xml);
if (doc.Error())
return false;
return true;
}
void xml_core::process_settings_wnd(std::string &data, std::string &message)
{
char buff[2600];
memset(buff,0,2600);
#ifdef WIN32
sprintf_s(buff, 2600, state_xml,message.c_str());
#else
sprintf(buff,state_xml,message.c_str());
#endif
data = std::string(buff);
}
void xml_core::process_state(std::string &out_data, std::string in_data, std::string &message)
{
TiXmlDocument doc;
TiXmlNode *node;
std::string edit_state;
doc.Parse(in_data.c_str());
if (doc.Error())
return;
TiXmlNode *root = doc.RootElement();
if (root && !strcmp(root->ToElement()->Value(), "FormState"))
{
const char* form_id = root->ToElement()->FirstAttribute()->Value();
if (form_id && !strcmp(form_id, "sample"))
{
for (node = root->FirstChild(); node; node = node->NextSibling())
{
const char* control = node->ToElement()->Value();
if (!strcmp(control, "Edit"))
{
const char * id = node->ToElement()->FirstAttribute()->Value();
if (!strcmp(id, "edit_new_text"))
{
const char * state = node->ToElement()->GetText();
if (state)
message = std::string(state);
else
message = std::string("");
edit_state.clear();
edit_state.append(message);
}
}
if (!strcmp(control, "Button"))
{
const char * id = node->ToElement()->FirstAttribute()->Value();
if (!strcmp(id, "button_set"))
{
const char *state = node->ToElement()->GetText();
if (!strcmp(state, "true"))
{
message = edit_state;
}
}
}
}
}
}
process_settings_wnd(out_data, message);
}
#endif
1>------ 已启动生成: 项目: sample, 配置: Debug Win32 ------
1>正在编译...
1>xml_inte易做图ce.cpp
1>d:\camfrog bot\plugins\sample-src\xml_inte易做图ce\xml_inte易做图ce.cpp(27) : error C2059: 语法错误 : “字符串”
1>d:\camfrog bot\plugins\sample-src\xml_inte易做图ce\xml_inte易做图ce.cpp(30) : error C2447: “{”: 缺少函数标题(是否是老式的形式表?)
1>生成日志保存在“file://e:\Camfrog Bot\plugins\sample-src\temp\Debug\BuildLog.htm”
1>sample - 2 个错误,0 个警告
========== 生成: 成功 0 个,失败 1 个,最新 0 个,跳过 0 个 ========== --------------------编程问答-------------------- 发错地了,这是c#
补充:.NET技术 , C#