在下面的代码段中获取分段错误,该代码段预期采用可变输入行ex(line1 = JMP START line2 = START LOAD R1 A1)。
while(fgets(inputt,249,stdin) != NULL){
if (count==0){
if(inputt[0] != ' '){
token = strtok(inputt," ");
//v segfault
datanode->name=token;
}
token = strtok(inputt," ");
if(token != NULL){
//vsegfault
datanode->action=token;
}
token = strtok(inputt," ");
if(token != NULL){
//v segfault
datanode->datta=token;
}
token = strtok(inputt," ");
if(token != NULL){
//v segfault
datanode->datta2=token;
}
list = createList(datanode);
}
谢谢。