你能帮我弄清楚我的代码中有什么问题..我想编辑一个特定的行.... thnx
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main (){
char arr[50];
char arr2[50];
char arr3[50];
FILE *stream = NULL;
FILE *stream2 = NULL;
stream = fopen("studentinfo.txt", "rt");
stream2 = fopen("studentinfo2.txt", "w+");
char* token;
char dlm[] = ",";
printf("Enter student id: ");
scanf("%s", arr2);
printf("New student id: ");
scanf("%s", arr3);
while(!feof(stream)){
fgets(arr,100,stream);
fprintf(stream2,"%s",arr);
token = strtok(arr,dlm);
if(strcmp(arr2, token)==0){
fseek ( stream2 , 0 , SEEK_CUR );
fputs ( arr3 , stream2 );
}
}
fclose ( stream2 );
fclose ( stream );
getch();
}