请问一个报错,是关于指针付值报错的.各位请进

请教一个报错,是关于指针付值报错的.各位请进
struct   tagXURule{
        CString   rule;
        struct   tagXURule     *next;
};//一条规则
typedef   struct   tagXURule   tagXURule;

tagXURule*   InsertedRule;
CString   rulestr;
InsertedRule=(tagXURule*)malloc(sizeof(tagXURule));//构造一个规则,分配内存空间

InsertedRule-> rule=rulestr;//要插入的规则内容
InsertedRule-> next=NULL;//这两行是把这个要插入的rule付值

单步调试时候,在到数第二行InsertedRule-> rule=rulestr出错了,是有关Access   Violation的错误
请有心人,告诉我到底是什么错误,谢谢

------解决方案--------------------
你先要搞清楚 malloc 与 new有什么区别???
他们最大的区别其实就是 new 能引发被创建对象的构造函数 而malloc则是单一的分配内存

struct tagXURule{
CString rule;
struct tagXURule *next;
};//一条规则

我们用malloc 分配了一个该结构大小的内存,但是却不能引发 CString rule; 的构造.....
这会使我们到数第二行InsertedRule-> rule=rulestr出错了
左边只是一块内存,而右边是一个对象。。。。
不用再说了吧!
//*****************************
struct tagXURule{
CString rule;
struct tagXURule *next;
};//一条规则
typedef struct tagXURule tagXURule;
tagXURule* InsertedRule;
CString rulestr;
InsertedRule = new tagXURule;//构造一个规则,不要再用malloc 那是c的东西
rulestr = "haha ";
InsertedRule-> rule=rulestr;//要插入的规则内容
InsertedRule-> next=NULL;//这两行是把这个要插入的rule付值
delete InsertedRule;