![]() The operations are most generally performed on the specific objects are one of the above specific classes is associated with the real files this procedure is known as an open file. We have already been used as the classes that are related to our file streams and in fact, we can use our file stream operations in the same way we have already used to the cin and cout operations with only the differences that we associated with these streams using physical files. We already used objects whose types are the classes using cin as an object of istream class and cout is the object of ostreamclass. Also, these classes are derived directly or indirectly from the classes using istream and ostream. In Generally c++ provides different classes for to perform the input and output characters from the specific files like ofstream the stream class which has to be written on the files,ifstream which has been read from the files, and finally we used fstream class for accessing both read and write from the files. But instead of that, we used to write the datas to the screen using the << operator with the help of file stream objects like fstream or ofstream through these object instances we may print the output results in the user screen. The basic difference between this write files and other default file functions like “cout” which has the default keyword to print whatever the printing datas of the user requirement which is to be displayed on the screen. Whenever we want to write the datas using file stream functions we used basic insertion operators like <<its just use as an operator to print the output datas to the user screen. ![]() some logics depends upon the requirement. O << "print this file data to the user screen" // << operator which is used to print the file informations in the screen ![]() O.open("filename with extension") //open is the method of ofstream ![]() Ofstream o //ofstream is the class for fstream package #include //include the filestreamobject as the header files The c++ write is used to print the datas to the files using some stream operators like insertion operator( //include the header files like input-output streams Web development, programming languages, Software testing & others ![]()
0 Comments
Leave a Reply. |