std::basic_filebuf::close

来自cppreference.com
< cpp‎ | io‎ | basic filebuf

 
 
 
std::basic_filebuf
公共成员函数
原文:
Public member functions
文本通过谷歌翻译机器翻译。
你可以帮忙校正和验证翻译。点击此处查看指示。
basic_filebuf::close
受保护的成员函数
原文:
Protected member functions
文本通过谷歌翻译机器翻译。
你可以帮忙校正和验证翻译。点击此处查看指示。
非成员函数
原文:
Non-member functions
文本通过谷歌翻译机器翻译。
你可以帮忙校正和验证翻译。点击此处查看指示。
 
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().

目录

[编辑] 参数

(无)
原文:
(none)
文本通过谷歌翻译机器翻译。
你可以帮忙校正和验证翻译。点击此处查看指示。

[编辑] 返回值

*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
(公开成员函数) [编辑]
解构一个basic_filebuf对象,如果它是开放的,并关闭该文件
原文:
destructs a basic_filebuf object and closes the file if it is open
文本通过谷歌翻译机器翻译。
你可以帮忙校正和验证翻译。点击此处查看指示。

(虚公开成员函数) [编辑]