A
A
andoral2018-08-18 15:45:59
C++ / C#
andoral, 2018-08-18 15:45:59

How to open a stream for writing and then for reading?

Tried like this:

using (var stream = response.GetResponseStream())
{
    using (var sw = new StreamWriter(stream))
    {
        sw.Write("X");
    }
}

using(var stream = response.GetResponseStream())
{
    using(var sr = new StreamReader(stream))
    {
        responseString = sr.ReadToEnd();
    }
}

- on reading "The stream was unreadable"

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question