Reading a Block of Characters into a String

  • Thread starter Thread starter Phil Galey
  • Start date Start date
P

Phil Galey

I have huge image files, from which I need to read only the first 20,000
characters, looking for a particular substring. The closest I've come to
being able to do that is with the StreamReader. But the ReadBlock only
gives you a char array and the ReadToEnd, which does read into a string,
would take about an hour.

How can I read into a string the first 20,000 characters of an image file?
Thanks.
 
Phil said:
The closest
I've come to being able to do that is with the StreamReader. But the
ReadBlock only gives you a char array

Once you've got your data into a char array, you can easily convert it into
a string as follows:

\\\
Dim s As New String(yourCharArray)
///
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top