Hi people, need some help in closing the window after program execution has completed.
I am running Turbo c++ 4.5 for windows under Win7 32. Thanks.
Heres the sample code:
//Read and display test customer file
#include <stdio.h>
#include <conio.h>
#include <iostream.h>
struct customer
{
char c_name[50];
int i_age;
};
int main(void)
{
clrscr();
struct customer rec;
FILE *stream;
if((stream = fopen("Personel.dat", "r" )) == NULL)
{
cout << "Error opening file\n";
return 1;
}
while(!feof(stream))
{
fread(&rec, sizeof(rec), 1, stream);
{
if(feof(stream)) break;
}
cout << rec.c_name << " age " << rec.i_age << "\n";
};
fclose(stream);
cout << "\n\nEnd of file!";
getch();
return 0;
}