By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,812 Members | 1,288 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,812 IT Pros & Developers. It's quick & easy.

Putting stream text data into a string possible without a fixed-sized buffer?

P: n/a
Hi,

I do a webrequest and it returns some text data in a stream. I want to
put this tyext data into a string. I've got it working just fine, but
I have to put the text data into into a fixed-size buffer BEFORE I put
it into a string (ConstBufferByteSize=1000000). This fixed size buffer
wastes space. Is it possible to somehow assign it straight to a
string, or somehow do this 'dynamically' ?
'' Put the XML response into a string to display
Dim tempBuffer(ConstBufferByteSize) As Byte
Dim enc As New System.Text.ASCIIEncoding

responseStream.Read(tempBuffer, 0,
ConstBufferByteSize) ' Read from the stream x bytes and put into a
temporary buffer

responseStream.Close() ' Close
the request stream to free up resources

strResponse =
enc.GetString(tempBuffer) ' Put the response into
a string (finally!)
' responseStream.Length.ToString() ' <- Can't get the
length to signify the buffer size ???

Any kind of help will do,

thankyou

Jack.

Jul 20 '07 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.