我尝试将name1和sname1内的内容分配给newnode-> name和newnode-> sname。但它出现了错误:无效的数组分配"。我只是一个初学者,有人可以指路吗?
class records
{
struct student
{
char name[30];
char sname[30];
};
...
};
...
void record :: loadRecord
{
student *newnode;
char name1[30], sname1[30];
newnode = new student;
ifstream in_stream("file.txt");
...
while(in_stream >> name1 >> sname1)
{
...
newnode->name = name1; //error
newnode->sname = sname1; //error, help!
...
}
}