CBSE Class 12 Computer Science Data File Handling In C++ Concepts

Read and download free pdf of CBSE Class 12 Computer Science Data File Handling In C++ Concepts. Get printable school Assignments for Class 12 Computer Science. Class 12 students should practise questions and answers given here for Data File Handling In C++ Concepts Computer Science in Class 12 which will help them to strengthen their understanding of all important topics. Students should also download free pdf of Printable Worksheets for Class 12 Computer Science prepared as per the latest books and syllabus issued by NCERT, CBSE, KVS and do problems daily to score better marks in tests and examinations

Assignment for Class 12 Computer Science Data File Handling In C++ Concepts

Class 12 Computer Science students should refer to the following printable assignment in Pdf for Data File Handling In C++ Concepts in Class 12. This test paper with questions and answers for Class 12 Computer Science will be very useful for exams and help you to score good marks

Data File Handling In C++ Concepts Class 12 Computer Science Assignment

DATA FILE HANDLING IN C++

File

A file is a stream of bytes stored on some secondary storage devices.

• Text file: A text file stores information in readable and printable form. Each line of text is terminated with an EOL (End of Line) character.

• Binary file: A binary file contains information in the non-readable form i.e. in the same format in which it is held in memory.

File Stream

• Stream: A stream is a general term used to name flow of data. Different streams are used to represent different kinds of data flow.

• There are three file I/O classes used for file read / write operations.

 ifstream - can be used for read operations.

 ofstream - can be used for write operations.

•  fstream - can be used for both read & write operations.

 

File modes:

• ios::out It open file in output mode (i.e write mode) and place the file pointer in beginning, if file already exist it will overwrite the file.

• ios::in It open file in input mode(read mode) and permit reading from the file.

• ios::app It open the file in write mode, and place file pointer at the end of file i.e to add new contents and retains previous contents. If file does not exist it will create a new file.

• ios::ate It open the file in write or read mode, and place file pointer at the end of file i.e input/ output operations can performed anywhere in the file.

• ios::trunc It truncates the existing file (empties the file).

• ios::nocreate If file does not exist this file mode ensures that no file is created and open() fails.

• ios::noreplace If file does not exist, a new file gets created but if the file already exists, the open() fails.

• ios::binary Opens a file in binary mode.

eof(): This function determines the end-of-file by returning true(non-zero) for end of file
otherwise returning false(zero).

close(): This function terminates the connection between the file and stream associated with it.

Stream_object.close(); e.g file.close();

Text File functions:

Char I/O :

· get() – read a single character from text file and store in a buffer.
e.g file.get(ch);

· put() - writing a single character in textfile e.g. file.put(ch);

· getline() - read a line of text from text file store in a buffer.
e.g file.getline(s,80);

· We can also use file>>ch for reading and file<<ch writing in text file. But >> operator
does not accept white spaces.

Binary file functions:

· read()- read a block of binary data or reads a fixed number of bytes from the specified

stream and store in a buffer.

Syntax : Stream_object.read((char *)& Object, sizeof(Object));
e.g file.read((char *)&s, sizeof(s));

· write() – write a block of binary data or writes fixed number of bytes from a specific
memory location to the specified stream.

Syntax : Stream_object.write((char *)& Object, sizeof(Object));
e.g file.write((char *)&s, sizeof(s));

Note:

Both functions take two arguments.

• The first is the address of variable, and the second is the length of that variable in bytes. The address of variable must be type cast to type char*(pointer to character type)

• The data written to a file using write( ) can only be read accurately using read( ).

Please refer to attached file for CBSE Class 12 Computer Science Data File Handling In C++ Concepts

CBSE Class 12 Computer Science Data File Handling In C++ Concepts Assignment

We hope you liked the above assignment for Data File Handling In C++ Concepts which has been designed as per the latest syllabus for Class 12 Computer Science released by CBSE. Students of Class 12 should download and practice the above Assignments for Class 12 Computer Science regularly. We have provided all types of questions like MCQs, short answer questions, objective questions and long answer questions in the Class 12 Computer Science practice sheet in Pdf. All questions have been designed for Computer Science by looking into the pattern of problems asked in previous year examinations. You can download all Revision notes for Class 12 Computer Science also absolutely free of cost. Lot of MCQ questions for Class 12 Computer Science have also been given in the worksheets and assignments for regular use. All study material for Class 12 Computer Science students have been given on studiestoday. We have also provided lot of Worksheets for Class 12 Computer Science which you can use to further make your self stronger in Computer Science.

Where can I download in PDF assignments for CBSE Class 12 Computer Science Data File Handling In C++ Concepts

You can download free Pdf assignments for CBSE Class 12 Computer Science Data File Handling In C++ Concepts from StudiesToday.com

How many topics are covered in Data File Handling In C++ Concepts Computer Science assignments for Class 12

All topics given in Data File Handling In C++ Concepts Computer Science Class 12 Book for the current academic year have been covered in the given assignment

Is there any charge for this assignment for Data File Handling In C++ Concepts Computer Science Class 12

No, all Printable Assignments for Data File Handling In C++ Concepts Class 12 Computer Science have been given for free and can be downloaded in Pdf format

Are these assignments for Data File Handling In C++ Concepts Class 12 Computer Science designed as per CBSE curriculum?

Latest syllabus issued for current academic year by CBSE has been used to design assignments for Data File Handling In C++ Concepts Class 12

Are there solutions or answer keys for the Class 12 Computer Science Data File Handling In C++ Concepts assignments

Yes, we have provided detailed answers for all questions given in assignments for Data File Handling In C++ Concepts Class 12 Computer Science