F
fuenfzig
Hi all,
I want to use a single std::stringbuf for writing (by a std:stream)
and for reading (by a std::istream), concurrently in two threads.
This came to my mind, because the code for reading should be the same
as with any ordinary istream, and it cannot be changed.
Now my problem is, that I do not get any data inside the reading loop
std:fstream tempfile("test.pdf", std::ios_base:ut |
std::ios_base::trunc | std::ios_base::binary);
while (!is->eof()) {
is->read(buffer, bufferSize);
tempfile.write(buffer, is->gcount());
tempfile.flush;
}
The writing thread proceeds as expected and finally finishes writing.
Any hints or comments?
Thanks,
Christoph
I want to use a single std::stringbuf for writing (by a std:stream)
and for reading (by a std::istream), concurrently in two threads.
This came to my mind, because the code for reading should be the same
as with any ordinary istream, and it cannot be changed.
Now my problem is, that I do not get any data inside the reading loop
std:fstream tempfile("test.pdf", std::ios_base:ut |
std::ios_base::trunc | std::ios_base::binary);
while (!is->eof()) {
is->read(buffer, bufferSize);
tempfile.write(buffer, is->gcount());
tempfile.flush;
}
The writing thread proceeds as expected and finally finishes writing.
Any hints or comments?
Thanks,
Christoph