well i haven't tried your code but i think u r making 1 mistake n not writing 1 statement:

1) u r closing the file before displaying the values, and
2) use getch(); [header file conio.h] at the end of the code, before the closing bracelet of main().

i think that shud work!!! maybe closing file after wont change anything but yes, u need to put getch() in your code!!!