Its been my experience that .dat files contain binary data, such as the computer's binary representation of an integer and not the ascii digits that you will find in a text file. .dat files normally can not be easily read by text editors such as Notepad.exe.
Exemple:
struct mystruct
{
int a;
long b;
float c;
double d;
};
int main()
{
myruct s
// write the structure to the file
ofstream out("mydata.dat", ios::binary);
out.write((char *)&s,sizeof(s));
out.close();
// now read the file
ifstream in("mydata.dat", ios::binary);
in.read((char*)&s,sizeof(s));
in.close();
}
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Offline 21,953 posts
since Aug 2005