views:

25

answers:

1
Dim intChunkId As Integer = &H4D546864   
Dim strCunnkId As String = "MThd"

Dim easiestWay = GetString(intChunkId)
A: 
Dim bytes As Byte() = BitConverter.GetBytes(intChunkId)
Dim strChunkId As String = Encoding.ASCII.GetString(bytes)

A couple of points:

  1. This assumes the bytes in the integer are all the ASCII range (the ones in your example are, but they might not always be: in that case, you can use Encoding.Default.)
  2. My VB is a bit rusty, I'm not sure I got the declaration of arrays right...
Dean Harding
Shimmy
@Shimmy: yeah, but it's only one extra line :-)
Dean Harding
It's one extra processing.I guess I will make a second static readonly variable that contains the calculated result.
Shimmy