mode specifies the type of access you require to the stream. It may be any of the following: * 'r' - Open for reading only; place the file pointer at the beginning of the file. * 'r+' - Open for reading and writing; place the file pointer at the beginning of the file. * 'w' - Open for writing only; place the file pointer at the beginning of the file and truncate the file to zero length. If the file does not exist, attempt to create it. * 'w+' - Open for reading and writing; place the file pointer at the beginning of the file and truncate the file to zero length. If the file does not exist, attempt to create it. * 'a' - Open for writing only; place the file pointer at the end of the file. If the file does not exist, attempt to create it. * 'a+' - Open for reading and writing; place the file pointer at the end of the file. If the file does not exist, attempt to create it.
* 'r+' - Open for reading and writing; place the file pointer at the beginning of the file.
* 'w' - Open for writing only; place the file pointer at the beginning of the file and truncate the file to zero length. If the file does not exist, attempt to create it.
* 'w+' - Open for reading and writing; place the file pointer at the beginning of the file and truncate the file to zero length. If the file does not exist, attempt to create it.
* 'a' - Open for writing only; place the file pointer at the end of the file. If the file does not exist, attempt to create it.
* 'a+' - Open for reading and writing; place the file pointer at the end of the file. If the file does not exist, attempt to create it.