std::basic_filebuf::close
|
|
Эта страница была переведена автоматически с английской версии вики используя Переводчик Google. Перевод может содержать ошибки и странные формулировки. Наведите курсор на текст, чтобы увидеть оригинал. Щёлкните здесь, чтобы увидеть английскую версию этой страницы. (Вы можете помочь в исправлении ошибок и улучшении перевода. Для инструкций перейдите по ссылке.) |
<metanoindex/>
<tbody> </tbody> std::basic_filebuf<CharT, Traits>* close(); |
||
If a put area exist (e.g. file was opened for writing), first calls overflow(Traits::eof()) to write all pending output to the file, including any unshift sequences.
If the most recently called function, out of underflow(), overflow(), seekpos(), and seekoff(), was overflow(), then calls std::codecvt::unshift(), perhaps multiple times, to determine the unshift sequence according to the imbued locale, and writes that sequence to file with overflow(Traits::eof()).
Then, closes the file as if by calling std::fclose, regardless of whether any of the preceding calls succeeded or failed.
If any of the function calls made, including the call to std::fclose, fails, returns a null pointer. If any of the function calls made throws an exception, the exception is caught and rethrown after calling std::fclose. If the file is already closed, returns a null pointer right away.
In any case, updates the private member variable that is accessed by is_open().
Параметры
(Нет)
Возвращаемое значение
*this на успех, нулевым указателем на провал.*this on success, a null pointer on failure.Вы можете проверить и исправить перевод. Для инструкций щёлкните сюда.
Заметки
close() is typically called through the destructor of std::basic_filebuf (which, in turn, is typically called by the destructor of std::basic_fstream.
Пример
| Этот раздел не завершён Причина: нет примера |
См. также
| checks if the associated file is open (public функция-элемент) | |
[virtual] |
basic_filebuf разрушает объект и закрывает файл, если он открыт Оригинал: destructs a basic_filebuf object and closes the file if it is open Текст был переведён автоматически используя Переводчик Google. Вы можете проверить и исправить перевод. Для инструкций щёлкните сюда. (virtual public функция-элемент) |