Solved

STream Reader and buffer

Posted on 2013-06-27
6
328 Views
Last Modified: 2013-06-27
In my code below, is there a way I can set the readBuff dynamically?

While streamResponse.CanRead
    Dim streamRead As New StreamReader(streamResponse)
    Dim readBuff(5120) As [Char]
    Dim count As Integer = streamRead.Read(readBuff, 0, 5120)

Etc...

Open in new window

0
Comment
Question by:lrbrister
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 42

Assisted Solution

by:sedgwick
sedgwick earned 500 total points
ID: 39281122
Dim size as Integer = 5120
Dim readBuff(size) As [Char]

Open in new window

0
 
LVL 25

Expert Comment

by:Luis Pérez
ID: 39281126
Can you please explain better what's your problem?
0
 
LVL 42

Expert Comment

by:sedgwick
ID: 39281130
u can use a variable instead the number when u initialize the array.
0
Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

 

Author Comment

by:lrbrister
ID: 39281162
Ok guys...
So there's no dynamic setting of the number based on the Stream itself?
0
 
LVL 42

Accepted Solution

by:
sedgwick earned 500 total points
ID: 39281166
nop.
there's no Length or Size property of StreamReader
http://msdn.microsoft.com/en-us/library/system.io.streamreader_fields.aspx
if u have control of the response stream, u can decide that the 1st 4 bytes of the stream is the length.
so u read the 1st 4 bytes of the responseStream, init the array and read the rest of the stream.
0
 

Author Closing Comment

by:lrbrister
ID: 39281216
Thanks
0

Featured Post

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question