| | |
Making a .dat file
Please support our C++ advertiser: Programming Forums - DaniWeb Sister Site
![]() |
Show us your basic attempt start to the code with
[code][/code] tags. "One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
•
•
Join Date: Mar 2005
Posts: 7
Reputation:
Solved Threads: 0
All I can figure is to make a .txt file and call it Scores.dat
In the file:
I'm supposed to read from the .dat file and compute the scores and assign a letter grade. I've got the program but I have no idea on where to start to make a .dat file.
Thanks for getting back with me.
In the file:
C++ Syntax (Toggle Plain Text)
Names Score1 Score2 Score3 Score4 Score5 Sims 91 89 73 81 93
I'm supposed to read from the .dat file and compute the scores and assign a letter grade. I've got the program but I have no idea on where to start to make a .dat file.
Thanks for getting back with me.
Last edited by mb1; Nov 1st, 2005 at 4:05 pm. Reason: Arrange information
•
•
•
•
I've got the program
•
•
•
•
program but I have no idea on where to start to make a .dat file.
•
•
•
•
All I can figure is to make a .txt file and call it Scores.dat
"One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
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:
Exemple:
C++ Syntax (Toggle Plain Text)
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(); }
![]() |
Similar Threads
- Reading .dat file data into an array (C#)
- How I can Open This .dat file --> This dat file is no ordinary (Graphics and Multimedia)
- Reading in a .dat file from SSH shell command line (Java)
- read a dat file through C (C)
Other Threads in the C++ Forum
- Previous Thread: 1 Error Message
- Next Thread: C books
Views: 18240 | Replies: 6
| Thread Tools | Search this Thread |
Tag cloud for C++
6 add api array arrays beginner binary bitmap c++ c/c++ calculator char class classes code compile compiler console conversion convert count data delete desktop directshow dll encryption error file forms fstream function functions game getline givemetehcodez google graph homeworkhelper iamthwee ifstream input int integer java lazy lib linkedlist linux loop looping loops map math matrix memory microsoft newbie news node number output parameter pointer problem program programming project proxy python random read recursion recursive reference return sort string strings struct studio system template templates test text tree unix url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






