The best thing to do is get a reference book, preferably hardcopy, though there are some online resources as well. In general you use filestream objects to read and write to files as opposed to an istream object (cin) and on ostream object(cout) to write to the screen. Once you get the syntax of declaring a filestream object and associating it with a given file then the syntax of using the filestream object is the same as using cin and cout. Each file is unique and unless you know how it is set up it can be difficult to read it efficiently. Learning about appending to vs overwriting of (truncating) as well as whether file was written in tex mode or binary and other modes of file association is important, too.