324 |
|
//in single version, fall back to ifstream |
325 |
|
std::basic_filebuf<_CharT, _Traits>* fileBuffer = new std::basic_filebuf<_CharT, _Traits>(); |
326 |
|
|
327 |
< |
this->init(fileBuffer); |
328 |
< |
if (!fileBuffer->open(filename, mode)) |
327 |
> |
//it is safe to delete null pointer |
328 |
> |
delete internalBuf_; |
329 |
> |
internalBuf_ = fileBuffer; |
330 |
> |
|
331 |
> |
this->init(internalBuf_); |
332 |
> |
if (!fileBuffer->open(filename, mode)) { |
333 |
|
this->setstate(ios_base::failbit); |
334 |
+ |
return false; |
335 |
+ |
} |
336 |
|
|
331 |
– |
//it is safe to delete null pointer |
332 |
– |
delete internalBuf_; |
333 |
– |
|
334 |
– |
internalBuf_ = fileBuffer; |
337 |
|
#endif |
338 |
|
|
339 |
|
return true; |