大家来帮帮忙啊

zzwwb1 2009-10-13 10:09:00
public class word
{
public long high;
public long low;
public float sig;
public word next;
}

public const int MAX_WORD_LEN_E_K = 20;


public class keyword
{
public char[] word = new char[MAX_WORD_LEN_E_K];
public int weight;
public keyword next;
}

public class forbidword
{
public char[] word = new char[MAX_WORD_LEN_E_K];
public forbidword next;
}


[DllImport("readdic.dll", EntryPoint = "read_forbid_dic")]
static extern int readforbiddic(string dicfilepath, forbidword forbid_dic_head);

[DllImport("readdic.dll", EntryPoint = "read_keyword_dic")]
static extern int readkeyworddic(string dicfilepath, keyword keyword_dic_head);

[DllImport("summary_e.dll", EntryPoint = "_english_entry_summary")]
static extern string entry(string document, int summary_size, forbidword forbid_dic_head, keyword keyword_dic_head);

string forbid_dic_path = "forbid_dic.txt";
string keyword_dic_path = "keyword_dic.txt";
string summary;
forbidword forbid_dic_head = new forbidword();

keyword keyword_dic_head = new keyword();






private void 开始_Click(object sender, EventArgs e)
{
forbid_dic_head.next = null;
keyword_dic_head.next = null;

if (readforbiddic(forbid_dic_path, forbid_dic_head) == -1)
{
MessageBox.Show("read forbid dic error!");
return;
}
else
if (readkeyworddic(keyword_dic_path, keyword_dic_head) == -1) {
MessageBox.Show("read keyword dic error!");
return;
}
else
{
StreamReader TxtReader = new StreamReader("1.txt", System.Text.Encoding.GetEncoding("gb2312"));
summary = entry(TxtReader.ReadToEnd(), 512, forbid_dic_head, keyword_dic_head);
MessageBox.Show(summary);
}
}



红色加粗代码报错:Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
...全文
61 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
zzwwb1 2009-10-14
  • 打赏
  • 举报
回复
各位高手帮忙啊
windz 2009-10-14
  • 打赏
  • 举报
回复
。。。。第一反应你换个类名试试
zhao38322684 2009-10-13
  • 打赏
  • 举报
回复
貌似要写入的内存不允许访问吧。
lerit 2009-10-13
  • 打赏
  • 举报
回复
内存申请不够?
zzwwb1 2009-10-13
  • 打赏
  • 举报
回复
补充一下
debug时:报如上错误
release时:readforbiddic(forbid_dic_path, forbid_dic_head) == -1,弹出对话框“read forbid dic error!”

110,545

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧