What are the different classes used for reading and writing to and from files in C++?

Different classes used for reading and writing to and from files are as follows:

Classes Description
ofStream This class is used for writing onto files
ifStream It is used for reading from files
fStream It is used for both reading and writing onto files

What are the different file opening modes in C++?

Different file opening modes in C++ are as follows:

Modes Description
ios::in Opens a file for reading. New contents cannot be written in the file.
ios::out Opens a file for writing. If file exist already then its contents are deleted but if the file does not exist it will create a new file.
ios::binary It opens a file in binary form.
ios::truncate Opens a file for writing. If file already exists then its previous contents are replaced with the new contents.
ios::app Opens a file in append mode. It adds new content at the end of the file.
ios::ate It is used to write new contents at the end of the file and we can also modify the previous contents.
ios::nocreate It does not allow to create a new file if it does not exist.
Ios::noreplace It does replace the old file with new file.

How to open and close files in C++?

A header file fstream.h is used in order to work with the files in C++ which include functions for opening and closing files.
For opening a file:
In order to open a file open() member function of fstream’s class is used.
Syntax: open (filename, mode)
Here filename is the name of the file to open and mode can be mode available in C++.
For closing a file:
In order to close a file close() member function of fstream’s class is used. This function takes no arguments.

What are escape sequences?

Escape sequences are used with a ‘\’ backslash character and are used in printf statements in order to display the output of the program in a specific form. List of escape sequences:

Character Escape sequence

Double quotation mark \”
Single quotation mark \’
Question mark \?
Backslash \\
Beep \a
Backspace \b
Formfeed \f
Newlinw \n
Return \r
Tab \t

Who invented the Sewing Machine?

The inventor of safety pin, Walter Hunt invented the first basic Sewing Machine but he didn’t get it patented. Later in 1846, Elias Howe reinvented it. After this many claimed to invent it and some court cases were also filed. But in court it was found that Walter Hunt was the actual inventor of Sewing Machine.

Who invented the Safety Pin?

Safety Pin used to fasten clothes was invented by Walter Hunt. This small invention in the mid 19th century was very useful not only in fashion industry but also in every household.

What is Spidercam?

Spidercam is a trademark of a company which makes cameras used for an aerial view. Spidercam system helps cameras to move in horizontal as well as vertical direction. It gives a three dimensional view of the event and thus makes the event or sport more lively for viewers seeing it on television.

Spidercams are being used in DLF Indian Premier League and are providing more angles for viewers to see live cricket in action. Though it is said to be creating problems for batsmen as they are no able to concentrate due to its movement but the viewers are surely loving it.

What is RSS?

RSS stands for Really Simple Syndication or Rich Site Summary. For an internet user, RSS is really helpful as once subscribed, user can see all updates from that website in his or her browser. On the other hand webmasters find it extremely helpful to spread their content without any advertising costs.