Opened 16 years ago
Closed 15 years ago
#856 closed Bugs (fixed)
iostreams file_descriptor::write fails under Win32
| Reported by: | nobody | Owned by: | Jonathan Turkanis |
|---|---|---|---|
| Milestone: | Component: | iostreams | |
| Version: | None | Severity: | Problem |
| Keywords: | Cc: |
Description
in 1.33.1, file_descriptor::write(), append mode implemented as
#ifdef BOOST_IOSTREAMS_WINDOWS
if (pimpl_->flags_ & impl::has_handle) {
if (pimpl_->flags_ & impl::append) {
::SetFilePointer(pimpl_->handle_, 0, NULL, FILE_END);
if (::GetLastError() != NO_ERROR)
throw detail::bad_seek();
it is common mistake to call GetLastError() without checking function return value first. MSDN has special note for SetFilePointer():
"Note If the function returns a value other than INVALID_SET_FILE_POINTER, the call to SetFilePointer has succeeded. You do not need to call GetLastError."
So, file_descriptor::write() fails, if there is old uncleaned "last" error
Regards,
valeri.antonov@gmail.com
Change History (6)
comment:2 by , 15 years ago
| Component: | None → iostreams |
|---|---|
| Severity: | → Problem |
comment:5 by , 15 years ago
Note:
See TracTickets
for help on using tickets.
