file-stream-object("filename", mode);
File Modes | Description |
---|---|
ios::in" | Searches for the file and opens it in read mode only(if the file is found). |
ios::out | Searches for the file and opens it in write mode. If the file is found, its content are overwritten. If file is not found, a new file is created. Allows you to write to the file. |
ios::app | Searches for the file and opens it in append mode i.e. this mode allows you to append new data to the end of a file. If file is not found, a new file is created. |
"ios::binary" | Searches for the file and opens the file(if the file is found) in a binary mode to perform binary input/output file operations. |
ios::ate | Searches for the file, opens it and positions the pointer at the end of the file. This mode when used with ios::binary, ios::in and ios::out modes, allows you to modify the content of a file. |
"ios::trunc" | Searches for the file and opens it to truncate or deletes all of its content(if the file is found. |
"ios::nocreate" | Searches for the file and and if the file is not found, a new file will not be created. |
Coming Next
-
Python