我想知道是否用 ios::clear()
或不在这段代码中使用。
ifstream is;
is.open (file_name, ios::binary);
if (is.fail())
is.clear(), std::cout<<"error\n", std::exit(9);
如果我在代码中不再使用ifstream(因为... std::exit()
),我必须要 ios::clear()
的流?
调用 clear()
只清除由 fail()
, bad()
和 eof()
.
它不会以任何其他方式影响流。