Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (binarna == true) {
- file.open(path, ios::out | ios_base::binary);
- const char tabulator = '\t';
- const char newline = '\n';
- if (!file) {
- std::cout << "Error in creating output file...\n";
- }
- for (StudentCourses sc : get_student_courses()) {
- for (char c : sc.get_student().get_first_name()) {
- file.write(&c, sizeof(char));
- }
- file.write(&tabulator, sizeof(char));
- for (char c : sc.get_student().get_last_name()) {
- file.write(&c, sizeof(char));
- }
- file.write(&tabulator, sizeof(char));
- for (char c : sc.get_student().get_id()) {
- file.write(&c, sizeof(char));
- }
- file.write(&tabulator, sizeof(char));
- double fs = sc.get_final_score();
- file.write(reinterpret_cast<char*>(&fs), sizeof(double));
- file.write(&tabulator, sizeof(char));
- char lg = sc.get_courses().get_letter_grade();
- file.write(&lg, sizeof(char));
- file.write(&newline, sizeof(char));
- }
- file.close();
- }
Advertisement
Add Comment
Please, Sign In to add comment