12.3: Passing File Stream Objects to Functions in C++ 11319

Question

Write the definition of a function named  openLog . This function can be safely passed two arguments, an  fstream object and a  string object. The function associates the  fstream with a file whose name is formed by concatenating the second argument with the suffix ".log". The  fstream is made ready for output that is appended to the end of the file. If the file did not exist previously, false is returned; otherwise its content is deleted (truncated) and replaced by a single line:
    PREVIOUS CONTENT DELETED
and true is returned.

Solution
If you have a solution, please send via comment

No comments:

Post a Comment