basic_filebuf::open

basic_filebuf *open(const char *s, ios_base::openmode mode);

The member function endeavors to open the file with file name s, by calling fopen(s, strmode). Here strmode is determined from mode & ~(ate & | binary):

If mode & ios_base::binary is nonzero, the function appends b to strmode to open a binary stream instead of a text stream. It then stores the value returned by fopen in the file pointer fp. If mode & ios_base::ate is nonzero and the file pointer is not a null pointer, the function calls fseek(fp, 0, SEEK_END) to position the stream at end-of-file. If that positioning operation fails, the function calls close(fp) and stores a null pointer in the file pointer.

If the file pointer is not a null pointer, the function determines the file conversion facet use_facet< codecvt<E, char, T::state_type> >(getloc()), for use by underflow and overflow.

If the file pointer is a null pointer, the function returns a null pointer. Otherwise, it returns this.