A garbage data appears whenever i write the data in the text file… Why is it like that?
Here’s my code… Thanks
int main(void)
{
unsigned int option = 0;
int i = 0;
}
getch();
while(option != 5){
option = display();
switch(option){
case 5: save();
break;
}
for(i = 0; i < recordCtr; i++){
free(array[i]);}
}
}
save(){
FILE *stream = NULL;
stream = fopen("student.txt", "wt");
printf("\nSaving the student list directory. Wait a moment please...");
int i =0;
for (i=0; i<3; i++){
fprintf(stream, "%5s %30s %5s\n", array[i]->studentID, array[i]->name, array[i]->course);
}
fclose(stream);
}
There are some bugs.
When do you see garbage data. I mean under what Input?