Re: thank you Prelude for answering
[QUOTE]Originally posted by talal*c
hello, infact there is nothing wrong with your code, if you use fread to read "struct.txt" u'll see that u can get what u've written..
but if u try to see the contents of "struct.txt" by external programs like notepad.exe instead of reading records by c code, u will see different characters, and this is natural.. because when u open a file the content of file is what meaning u get..
here is the code..
void writerec(struct data *r)
{
printf("ID : %d \n",r->id);
printf("GPA : %d \n",r->gpa);
}
main()
{
..... bla bla
while(fread(&r,sizeof(struct data),1,fp))
writerec(&r);
fclose(fd);
getch();
.....
}