Chapter 12: Problem 46
Write code that opens the file data.txt for both input and output, but first determines if the file exists. If the file does not exist, the code should create it, then open it for both input and output.
Chapter 12: Problem 46
Write code that opens the file data.txt for both input and output, but first determines if the file exists. If the file does not exist, the code should create it, then open it for both input and output.
All the tools & learning materials you need for study success - in one app.
Get started for freeUnder what circumstances is a file stream object’s ios::hardfail bit set? What member function reports the state of this bit?
Under what circumstances is a file stream object’s ios::badbit bit set? What member function reports the state of this bit?
Which file access flag do you use to open a file when you want all output written to the end of the file’s existing contents?
Should file stream objects be passed to functions by value or by reference? Why?
T F If a file is opened in the definition of the file stream object, no mode flags may be specified.
What do you think about this solution?
We value your feedback to improve our textbook solutions.