Class 12 Data File Handling In C++ Revision Notes

Read and download free pdf of Class 12 Data File Handling In C++ Revision Notes. Students and teachers of Class 12 Computer Science can get free advanced study material, revision notes, sure shot questions and answers for Class 12 Computer Science prepared as per the latest syllabus and examination guidelines in your school. Standard 12 students should download this study material which will give them more knowledge for all chapters in Computer Science and all important topics which are scoring and can get you more marks. Students should also download free pdf of Chapter wise Notes for Class 12 Computer Science prepared by school teachers as per the latest NCERT, CBSE, KVS books and syllabus issued this year and also download free worksheets and question papers available here to get higher scores in school exams and tests, also click here for more Study Material for Class 12 Computer Science

File: - The information / data stored under a specific name on a storage device, is called a file.
Stream: - It refers to a sequence of bytes.
Text file: - It is a file that stores information in ASCII characters. In text files, each line of text is terminated with a special character known as EOL (End of Line) character or delimiter character.
When this EOL character is read or written, certain internal translations take place.
Binary file:- It is a file that contains information in the same format as it is held in memory. In binary files, no delimiters are used for a line and no translations occur here.
Classes used for different file related operation
ofstream: Object of ofstream class used to write data to the files.
ifstream: Object of ifstream class used to read from files
fstream: Object of fstream class used to both read and write from/to files.
Opening a file

Opening file using constructor
ofstream outFile("sample.txt");      //output only
ifstream inFile(“sample.txt”);        //input only
Opening File Using open ()“filename”, [mode]);
ofstream outFile;"sample.txt");
ifstream inFile;"sample.txt");
Class 12 Data File Handling In C++ Revision NotesAll these flags can be combined using the bitwise operator OR (|). For example, if we want to open the file example.dat in binary mode to add data we could do it by the following call to member
function open():
fstream file; ("example.dat", ios::out | ios::app | ios::binary);
Closing File
Input and output operation

put() and get() function
the function put() writes a single character to the associated stream. Similarly, the function get()
reads a single character form the associated stream.
example :



Click to View or Download pdf file
Click for more Computer Science Study Material

Latest NCERT & CBSE News

Read the latest news and announcements from NCERT and CBSE below. Important updates relating to your studies which will help you to keep yourself updated with latest happenings in school level education. Keep yourself updated with all latest news and also read articles from teachers which will help you to improve your studies, increase motivation level and promote faster learning

Celebration of Matribhasha Diwas Mother Language day

UNESCO has declared 21st February of every year to be celebrated as International Mother Language day to promote dissemination of Mother Language of all, create awareness of linguistic and cultural traditions and diversity across the world and to inspire solidarity...

CBSE Term 2 Board Examinations

CBSE vide Circular No.Acad-51/2021 dated 5th July, 2021, notified that in the session 2021-2022, Board Examinations would be conducted in two terms, i.e.. Term I and Term II. This decision was taken due to the uncertainty arising out of COVID 19 Pandemic. Term I...

CBSE Reading Challenge

The acquisition of 21st century competencies of communication, critical and creative thinking and the ability to locate, understand and reflect on various kinds of information has become more crucial for our learners. It is well accepted that Reading Literacy is not...

MCQ Question based CBSE examination

For 2021-22 CBSE has launched MCQ question-based examination for Term 1 & Term 2 board examinations. The entire syllabus has been divided into two parts each including 50% of the entire syllabus. To score well, students must practice as per the new CBSE term-wise...

Pariksha Pe Charcha 2022

The 5th edition of Pariskhas Pe Charcha the unique interactive program of Hon’ble Prime Minister with students teaches and parents will be held through virtual mode in February, 2022. In order to select participants who will be featured in Pariksha Pe Charcha programme...

Class 10th and 12th Term 2 Revaluation Process 2022

Evaluation of the Answer Books is done under a well-settled Policy. To ensure that the evaluation is error free, CBSE is taking several steps. After strictly following these steps, the result is prepared. Though, CBSE is having a well-settled system of assessment,...