iostream means standard input output function.fstream means those funtion which perform operation on disk mean read from the disk as well as write to the disk.
<iostream.h> is an old style of programming and does not allow using namespaces. If you use <iostream> you can use namespaces, and limit number of predefined function (not used) included with your program.
#include <iostream> #include <fstream> int main() { std::fstream f("myfile.txt", std::ios::in | std::ios::out | std::ios::trunc); if (!f.bad()) { // write to file f << "The brown fox jumps over the lazy dog" << std::endl; f.close(); // read from file f.open("myfile.txt", std::ios::in); std::cout << f.rdbuf(); f.close(); } }
In C++, seekg is a method/function of the standard fstream library (fstream::seekg()) which allows you to position the 'get' pointer to an arbitrary position within the stream.
Use Fstream. Be a little persistent, it's wonderful.
There is a 'getch' in 'conio.h' which has nothing to do with 'iostream'.
#include <fstream>
It's a bit difficult to show a class hierarchy using unformatted text alone, so I'll use the scope resolution operator to show the relationships instead. Note: [] denotes multiple inheritance ios_base ios_base::ios ios_base::ios::istream ios_base::ios::ostream: ios_base::ios::istream::ifstream ios_base::ios::ostream::ofstream ios_base::ios::[istream/ostream]::iostream ios_base::ios::[istream/ostream]::iostream::fstream ios_base::ios::[istream/ostream]::iostream::stdiostream ios_base::ios::[istream/ostream]::iostream::stringstream streambuf streambuf::filebuf streambuf::stdiobuf
difference between as on and as at
What is the difference between Florida and California What is the difference between Florida and California
what's the difference between physician and doctorwhat's the difference between physician and doctor what's the difference between physician and doctor
Difference between paging and what?
difference between enterprise and corporation