samedi 27 juin 2015

How to view .dat file generated by c++ program?

I am learning c++ file handling. First I generated a .txt file using fstream library and viewed data on notepad but when I created a something (a .dat file) unfortunately I am unable to open that file into any text editor, but I can get data from that file in C++. Is there any file viewer or way by using which I can view the .dat file?

void display_all()
{
    system("cls");
    cout<<"\n\n\n\t\tDISPLAY ALL RECORD !!!\n\n";
    fp.open("Shop.dat",ios::in);
    while(fp.read((char*)&pr,sizeof(product)))
    {
        pr.show_product();
        cout<<"\n\n====================================\n";
        getch();
    }
    fp.close();
    getch();
}

The above function is showing all the data in my Shop.dat file but when I open that file directly my OS in not determining what type of file is it.

Aucun commentaire:

Enregistrer un commentaire