GATE (Graduate Aptitude Test in Engineering) Computer Science & IT (CS) Programming and Data Structures-Programming in C Study Material (Page 23 of 36)
Choose Programs:
🎓 Study Material (1190 Notes): 2024-2025 Syllabus
Rs. 1000.00 -OR-
3 Year Validity (Multiple Devices)
Topic-wise Notes & SampleDetails
🎯 302 Numeric, 2894 MCQs (& PYQs) with Full Explanations (2024-2025 Exam)
Rs. 650.00 -OR-
3 Year Validity (Multiple Devices)
CoverageDetailsSample Explanation
Help me Choose & Register (Watch Video) Already Subscribed?
Checking Error in File Operation
Edit
- In C ++ , no file operations cause the program to stop. If an error occurs and is not checked, then the program will be running unreliably. Programmer is responsible to check i/o errors and do the needful.
- Testing for errors, either check error state bits or use methods like good () , fail () etc.
- A special method is_open () can be used to check whether opening file is successful or not. Method is_open () returns true if open is successful
For all other i/o operations, error can be checked using one of the follo…
… (1065 more words) …
Subscribe (by clicking here) to view full notes and track progress.
Modify and Delete Object Stored in Binary File and Random Access: Reading Nth Object from Binary File
Edit
Modify Object Stored in Binary File
Add function to modify marks of a specified student and write updated record back in binary file as shown here.
void modifyMarks ( )
{
//file for read/write purpose, so use fstream class
fstream file ( “ stud…
… (757 more words) …
Subscribe (by clicking here) to view full notes and track progress.