Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Streamreading an MP3 file...

 

Ok, if I open up an MP3 file in Wordpad then I'm presented with a whole bunch of ASCII characters. I'm trying to do the same in VB.NET using the following code...

 

Dim mp3file As IO.StreamReader = New IO.StreamReader(New IO.FileStream(mp3path, IO.FileMode.Open), System.Text.Encoding.ASCII)
Dim mp3data = mp3file.ReadToEnd
rtb1.Text = mp3data
mp3file.Close()

 

The problem is that 'mp3data' always comes out as just the first 4 characters, which are ID3�, and nothing else. I only ever work with normal text files so I'm a bit confused so I need someone to point out what is probably an extremely obvious solution for me. :D

 

Cheers!

I'm getting the hang of this now... No really I am!
  • *Gurus*
Posted

Textboxes are meant to display textual data, not binary. There is a hex viewing control in the framework that would probably be more suited to this task.

 

Try using a different encoding to read the data, ASCII I believe doesn't understand characters over 127.

MVP, Visual Developer - .NET

 

Now you see why evil will always triumph - because good is dumb.

 

My free .NET Windows Forms Controls and Articles

Posted

LOL the RTB was only there so I could keep an eye on output and it turned out to be working fine but as you said the RTB wouldn't show it.

 

Cheers.

I'm getting the hang of this now... No really I am!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...