What is the purpose of the ios::trunc flag in C++ file handling?
A. Truncates the file if it exists and opens it in write mode
B. Opens the file in trunc mode
C. Opens the file in read mode
D. Opens the file in append mode
Answer: Option A
A. Truncates the file if it exists and opens it in write mode
B. Opens the file in trunc mode
C. Opens the file in read mode
D. Opens the file in append mode
Answer: Option A
Which header file is required for file handling in C++?
A. <iostream>
B. <fstream>
C. <file>
D. <filestream>
Join The Discussion