Which of the following statements opens the file info.txt for both input and output? a) dataFile.open("info.txt", ios::in &&
amp; ios::out); b) dataFile.open("info.txt", ios::in , ios::out); c) dataFile.open("info.txt", input || output); d) dataFile.open("info.txt", ios::in | ios::out);
2 answers:
Answer:
D
Explanation: Choice D
Answer:
Correct answer is D
Explanation:
open is a function in c++ programming language used to interact with files.The function takes two parameters as input
- File name
- mode
File Name
File name is a string name of file to be opened.This is a compulsory parameter for open method.
Mode
Mode is an optional parameter in open function.Following are the accepted values of mode parameter
Prefix ios:: is added to start of each
- in (Open file in input mode for writing data to file)
- out (Open file in output / read-only mode to read data from file)
- binary (Open file in binary format)
- ate (Set the starting point of file to the end of file. Default starting point of file is start of file)
- "trunc" (If file is opened multiple times all previous data is replaced with new data)
- app (All operations of output are performed the end of file)
Use | operator to use multiple modes at a time.
You might be interested in
The answer is: switches.
Explanation:
Filtering is a function of switches.
It is a unit of disk space allocation for files and directories. Hope this helps :)
Answer:
data
Explanation:
got it right on edgenuity